Search and replace withing a file

1
2
3
4
5
6
7
sed -i -e"s/SEARCH_TEXT/REPPLACE_TEXT/g" FILENAME.txt

# another example using bakup
sed -i.bak -e"s/SEARCH_TEXT/REPPLACE_TEXT/g" FILENAME.txt

# another example using variable
sed -i -e"s/\/pathname/\/pathname-$date/g" "filename-"$date".xml"
This entry was posted in Bash, Linux, Operating System. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


nine + 8 =