Remy's Experience
Journal & Archives of Remy's Experience and Lessons
Thursday, January 14, 2016
Linux sed replace
sed -i.bkp 5'i'"s/search/replace/" inputfile
-i.bkp
take backup as
inputfile.bkp
and edit original file
5'i'
go to line 5
s/
search and replace
also can search specific word say 'NAME' and in same line search 'RAM' and replace with 'SHYAM'
sed -e '/NAME/s/RAM/SHYAM/g' filename
Reference
http://unix.stackexchange.com/questions/65064/how-to-find-and-replace-a-particular-string-in-a-specific-line
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment