Delete all characters after line "x" in every row

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
the_egg_man
Posts: 3
Joined: Tue Feb 10, 2009 5:30 pm
Location: Minneapolis

Delete all characters after line "x" in every row

Post by the_egg_man »

I have a file with two side by side groups of data and I want to remove everything in the second group. Something like this:

Code: Select all

Group A                               Group B
Rounding Report
Admission Report                      Patient Snapshot Report
MD Overview Report
Kardex Report                         Dept Orders Report
Maternal Assess Report
In the actual file Group B begins at column 77. In every row I want to delete everything beyond column 77.

Thanks,
Andrew
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

This will work to remove all characters after position 76

Search for: ^(.{76}).*
Replace with: \1

Use the following settings:
-----------------------------------------
[X] Regular expression
Replace All
-----------------------------------------
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
-----------------------------------------
Hope this was helpful.............good luck,
Bob
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

Search for: (^.{77}).*
Replace with : \1
Assumes posix regular expressions checked.

Might check that I'm not off by one on that 77
I choose to fight with a sack of angry cats.
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

Looks like I was, that's why we keep Bob around :P
I choose to fight with a sack of angry cats.
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Not sure I am right.

After looking at yours, and rereading the original request, he does ask to remove everything after 77. You took that literally, I thought something else was wanted ...... and should have been more careful in reading what was asked for.
Hope this was helpful.............good luck,
Bob
the_egg_man
Posts: 3
Joined: Tue Feb 10, 2009 5:30 pm
Location: Minneapolis

Thanks

Post by the_egg_man »

Thank you both. Yes, I wasn't terribly clear but the exact column position wasn't as important to me as syntax. This gives me just what I needed. Much appreciated. - Andrew
Post Reply