Page 1 of 1
insert and replace test
Posted: Wed Jan 13, 2010 1:47 am
by bensonuser
i have a file which looks like this:
1 19166100
2 19179581
3 FW127
i need to replace <character><space><space>
with <zero><zero><character> where the character can be any number
between one and 9. i know how to replace the blanks with zeros but i can't figure out how to keep the character without replacing each group
one at a time.
Posted: Wed Jan 13, 2010 1:58 am
by Bob Hansen
Based on your description, this sounds doable. But, I am finding your explanation confusing.
Could you provide a better example of Before and After strings? Use real examples vs. <character> and <zero>. It would be useful to use another char to represent the <space> so the count of spaces can be seen.
Posted: Wed Jan 13, 2010 2:20 am
by bensonuser
1,,19166100
2,,19179581
3,,fw127
the , represents a space.
the end result would look like this:
00119166100
00219179581
003fw127
hope this makes everything a bit more clear. sorry for the confusion.
thanks for the quick response
Posted: Wed Jan 13, 2010 3:06 am
by Bob Hansen
This works for one or more leading digits:
Search for: ^([0-9]+),,
Replace with: 00\1
Per your example, using comma "," for spaces.
Use the following settings:
-----------------------------------------
[X] Regular expression
Replace All
-----------------------------------------
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
-----------------------------------------
thanks for the solution
Posted: Wed Jan 13, 2010 1:36 pm
by bensonuser
thanks very much.
works like a charm.
you guys are great!