Adding text to end of line

Find, replace, find in files, replace in files, regular expressions

Adding text to end of line

Postby Jon12345 » Wed Jul 05, 2006 1:57 pm

I have some data that looks like this:

"mytext1"
"mytext2"
"mytext3"

I want to change this so that I append the same phrase (at low prices) to each line so it looks like this:

"mytext1 at low prices"
"mytext2 at low prices"
"mytext3 at low prices"

How can I do this?

Please note that the text has quotes around it in my text file!

Thanks,

Jon
User avatar
Jon12345
Newbie
 
Posts: 2
Joined: Tue Jul 04, 2006 11:00 pm

Re: Adding text to end of line

Postby Mofi » Thu Jul 06, 2006 5:16 am

A very simple regular expression replace all will do it.

Find What: "$
Replace With: at low prices"

Make sure your file has no trailing spaces by using Format - Trim Trailing Spaces or use the following more complex regex (UltraEdit style):

Find What: "[ ^t]++$
Replace With: at low prices"
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4049
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Adding text to end of line

Postby Jon12345 » Thu Jul 06, 2006 8:41 am

Yes that did it thanks! And now I have found where you got it from so I have indirectly been taught how to fish! Thanks.
User avatar
Jon12345
Newbie
 
Posts: 2
Joined: Tue Jul 04, 2006 11:00 pm


Return to Find/Replace/Regular Expressions

cron