I want to delete a line containing a specific string from my file. I do it like that:
sed -i "/example/d" myfile
But my file contains many lines containing strings that contain the string that I want to delete. for example my file contains lines as bellow and I want to delete only the first line that contains "example":
myfile:
example
example1
example2
..
My question is how to do if want to delete only the line that contains exactly my string "example" and keep the other ones.
Simple. Be more specific.
sed -i "/\bexample\b/d" myfile
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.