Copy to a new line

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
jhajny
Posts: 1
Joined: Wed Oct 20, 2010 2:43 am

Copy to a new line

Post 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.
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post 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.
Post Reply