Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 3 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .