Page 1 of 1

Copy to a new line

Posted: Wed Oct 20, 2010 2:52 am
by jhajny
I have a text file which contains the following:

@BB ABC000001
@BB ABC000122
@BB ABC000145

Each "@" is a new line, the prefixes are the same, and the 6 digits are unique in all 400+ records. I am trying to copy the lines with the same ABC# but with a new @ notation. See my example below:

Original:
@BB ABC000001
@BB ABC000122
@BB ABC000145

Should Be:
@BB ABC000001
@CC ABC000001
@BB ABC000122
@CC ABC000122
@BB ABC000145
@CC ABC000145


I'm struggling with the Regular Expressions and any help is GREATLY appreciated.

Posted: Wed Oct 20, 2010 3:04 am
by ak47wong
Do a replace operation with these parameters:

Find what: @BB (.*)
Replace with: @BB \1\n@CC \1

Ensure the Regular expression check box is selected.

This assumes you are using POSIX regular expression syntax in Configure->Preferences->Editor.