Visit Our UNIX and Linux User Community


please help


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers please help
# 1  
Old 11-20-2001
Data please help

hi all,

I begin in Linux and I need change string in file.
I know the command grep for find the string in file but i don't know the command for change it Smilie

Please give me little exemple for my problem

thanx Smilie
# 2  
Old 11-20-2001
sed 's/search/replace/' <I>filename</I>


Result goes to standard out, so you can redirect it into a new file if you like.
# 3  
Old 11-20-2001
thanx very much.
# 4  
Old 11-20-2001
You can also, do it this way as well while in the file.

vi filename
:g /oldword/s//newword/g

Only one space after the first "g" and no other spaces. This will replace every instance in the file.
If you leave off the last "/g" it will only replace the next instance of the word you want to change.




Smilie
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #864
Difficulty: Medium
In 2019, the UNIX.com UserCP was rewritten in Vue.js by Neo.
True or False?

Featured Tech Videos