开发者

Find and Replace using Notepad++

I'm trying to use Notepad++ to do some find and replace as I'm dealing with up to few thousand of lines of data.

The below is the example of the data structure that i am dealing with.

A = Can be any Aplabet
X = Can be any Number 0-9
RX = Number that I开发者_Go百科 want to replace with another value.

AAAAA X.XXXXXX X.XXXXX X X X X X XX:XX:XX:XX.XXX XXX RXRXRXRXRXRX XXXXXX XXXXXX

Actual Example

werwer 2.178924  1.17892  1 1 1 1 1   12:14:44:59.123  123  0123123  123345  123123
gret   2.178975  1.15731  1 1 1 1 1   12:14:44:59.123  123  0123     123345  123123
sdfwe  2.123245  1.15171  1 1 1 1 1   12:14:44:59.123  123  0555312  123345  123123

Is there a shortcut I can use?


N++ is not the tool for the job as it has very limited regexp capabilities. In a decent editor, you could replace

((?:[a-zA-Z0-9:\.]+\s+){10})\d+(.*)

with

\1your_text\2

but notepad++ regex syntax supports neither (?:) nor {10}.

There are lots of regex tools out there, choose whichever.

P.S. I also tried repeating the first pattern ten times to emulate {10}, it still did not work strangely.


This looks like the sort of job that is perfect for awk.

awk '{print "$1 $2 $3 $4 $5 $6 $7 $8 $9 NUMBERS I'\''M CHANGING $11 $12"}' < file.txt > newfile.txt

You can also try vim's Block Highlighting and Insert/Change functionality. I don't know if notepad++ has anything similar to it.


press ctrl+F and then go to Replace tab.


refer to https://superuser.com/questions/214079/find-and-replace-using-notepad

whitequark solution

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜