For example, I want do remove all lines in a textile that do not contain the character '@'
I have already tried to use sed like so
sed '/@/!d' data.txt
What am I missing? Shouldn't this work?
For example, I want do remove all lines in a textile that do not contain the character '@'
I have already tried to use sed like so
sed '/@/!d' data.txt
What am I missing? Shouldn't this work?
I prefer using ed over the non-standard sed -i, especially if it needs to be portable:
printf "%s\n" "v/@/d" w | ed -s filename
This deletes every line that doesn't contain a @, and saves the changed file back to disc.
sed -n '/@/p' [file]
-n suppress default printing/@/ match on @ anywhere on the linep print if it matchesAdd -i for in-place editing of the file (if supplied).