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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

replacing string in files from command line 2

Status
Not open for further replies.

new2unix

Programmer
Feb 5, 2001
143
US
Hi,

I have a bunch files under a directory and each contain multiple email addresses. What would be the quick way, from the command line, to search for specific address and replace it to another if found? For example, look for user1@mycompany.org in each of the file under the dirctory and, if found, change it to user1@mypc.mycompany.org.

Thanks!

Mike
 
You have already get answer: thread80-412547
Anyway:
man sed
man ex

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
perl -p -i.bak -e 's/oldstring/newstring/' file1 file2 file3

does a nice, in place substitution, and provides a backup file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top