Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 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?

share|improve this question
    
Will the replace string start at fixed position in a line? –  jhamu Nov 23 '10 at 8:33
add comment

1 Answer

up vote 2 down vote accepted

As you've set the regex tag, I'll post two relevant ones here.

First one matches the end of your pattern exactly:

^(.+ )[0-9]{6}( [0-9]{6} [0-9]{6})$

And the second one ignores exact lengthes of the fields and just ensures that they are numerical and in correct positions:

^(.+ )[0-9]+( [0-9]+ [0-9]+)$

The replace string would be \1CHANGEDNUMBER\2.

Hope that helps you more than an answer with shortcuts everyone knows.

share|improve this answer
    
thanks man thats what I need! so much better than the CTRL+F CTRL+H –  Houston we have a problem Nov 23 '10 at 8:47
    
whitequark, is it possible to replace with a random number between 300,000 - 400,000? –  Houston we have a problem Nov 24 '10 at 3:35
    
I don't think it is possible with Notepad++, as that is (a fairly simple) programming problem. I can write the code in Perl or Ruby, if you have anything of that on your computer, or can install it. –  whitequark Nov 24 '10 at 4:40
    
I can install either one. Can I add you in MSN ? –  Houston we have a problem Nov 24 '10 at 4:50
    
I don't have MSN, but you can contact me with jabber (in my profile). –  whitequark Nov 24 '10 at 5:10
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.