Remove all text after a symbol per line

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
roonyroo
Posts: 2
Joined: Tue Nov 10, 2009 10:16 pm

Remove all text after a symbol per line

Post by roonyroo »

hi,
I was wondering how to remove all text after the character ; for everyline

Basically atm i have ie., sdfsfs; 1234c
asdasd; 987b


i need it to look like this sdsfs
asdasd

basically remove everything after ; for each line

thanks
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Remove all text after a symbol per line

Post by DataMystic Support »

Use a perl pattern search/replace
;[^\r\n]*?
Replace with nothing.
roonyroo
Posts: 2
Joined: Tue Nov 10, 2009 10:16 pm

Re: Remove all text after a symbol per line

Post by roonyroo »

is it possible to state the word to end at across multiple lines?

start at ; & remove everything until all lines in between until it hits the word dog?

;cat dfgdgdgdg
dfgdfgdg
dfg
dfgdfg
dfg dog


so it ends up as

;dog

thnx
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Remove all text after a symbol per line

Post by DataMystic Support »

Very easy, use an EasyPattern search/replace:

Code: Select all

[ mustBeginWith( ';' ), 1+ characters, mustEndWith('dog' ) ]
Replace with nothing.
Post Reply