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

Find and Replace

Status
Not open for further replies.

webdev17

Programmer
Feb 6, 2006
33
US
I'm trying to find a specific phone number in a group of files and replace it with a new phone number. Is there a way to do this with a unix command?

Thanks!
 
man sed, specifically something like:

/old_tel_no/c\
new_tel_number

Put this in a file (for example sedscr). Then use

sed -f sedscr filename > new_filename

to write the new details into new_filename. You can rename new_filename to the original later if preferred. I think gnu sed has an option to edit in-place (Feherke make be able to confirm).

Regards.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top