Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regular Expression Question 2

Status
Not open for further replies.

dbadmin

Programmer
Joined
Jan 3, 2003
Messages
147
Location
US
Hi Gurus,

I have a text file with about 200 lines. I need to search for a particular word "testing" and then add a character ":" at the end of those lines containing that word

Thank you in advance,
dbadmin
 
This is an alternative in case (a) the last line is nonempty and (b) containing "testing" and (c) still want a colon be inserted.
[tt] 's/(\n|$)/:\1/ if/testing/'[/tt]
 
Also made a quick test, on windows, it needs to enclose it with double quote, like it or not!
 
Hi,

Thank You guys.

dbadmin
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top