I\'m new to sed, so maybe someone can help me out. I\'m modifying some files and want to skip all lines that have the strings \"def\" or \"page.\" on them. How do I do this
AFAIK You can't (easily) negate matching lines with sed, but something like will almost work:
sed '/\([^d][^e][^f][^ ]\)\|\([^p][^a][^g][^e]\)/ s/foo/bar/' FILE
it replaces foo with bar on the lines which does not contain def or page but catch is that "matching" lines must be at least 4 char long.
A better solution is to use awk, e.g.:
awk '{ if ($0 !~ /def|page/) { print gensub("foo","bar","g") } else { print } }' FILE
HTH