Sed

From Secure Computing Wiki
Jump to: navigation, search

Great reference: http://www.grymoire.com/Unix/Sed.html#uh-0 GOLD: sed 1-liners

sed -i "" "1 s/foo/bar/" <filename>
sed -i '' -e 's/^.*foo.*//' -e '/^$/d' <filename>
sed -i -e '/foo/d' <filename>
sed -i -e 's/foo/bar/' <filename>
sed -e '/baz/s/foo/bar/' <filename>
sed -i '.bak' 's/foo/bar/g' <filename>
Personal tools
Namespaces
Variants
Actions
Miscellaneous
Operating Systems
Toolbox