sed
sed can be used to replace text in a file.
1 |
sed -i 's/old-string/new-string/g' file-name.txt |
g = Global, replace everything in a file.
s = substitute text
-i = update the file.
Delete lines matching string
To delete lines having a string and print result.
1 |
sed '/string to match/d' file-name.txt |
To update the file, use -i option
1 |
sed -i '/string to match/d' file-name.txt |