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!

Simple search and replace.

Status
Not open for further replies.

Jacqui1811

Programmer
Jul 8, 2002
100
SG
Hi guys.
I am really new to Unix and would like to have a simple search and replace statement that substitutes all the instances of one word with another in all the files in the current directory.
Hope you can help.
Jacqui.
 
man sed

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Sorry said I was really new to this.
Not sure what you mean by man sed and how I might pass in what I need to replace and what I replace it with.
Thanks.
 
At the shell prompt you type man sed and then you press the Enter key.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks.
I looked and now have it printing to the console with the replaced words.
I have also outputted to a new file and saved it.
Thanks for pointing me to the manual(and being patient about explaining how to get to it).
Jacqui.
[2thumbsup]
 
man replace

possibly easier ?


______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Redhat ES + it would seem, apologies I didnt check on the other flavours at my disposal. Fedora 4 doesn't have it and I wont even mention SCO 5. :(

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
cheers! i do not have that on OS X...


Kind Regards
Duncan
 
Yep, thats the one, must learn to read the top line of man output (or further down the page than just the bit I needed, it works very well though on your ordinary files :)

Its on all of our work servers, because mysql is on all of them too. There is a pattern emerging here whic I'm just beginning to see.....:D

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top