4 ms·
You don’t have to stack -v like that: -v inverts all the -e expressions, so this should be equivalent: grep -inHv -e foo -e bar -e baz
by fiddlerwoaroof 5y ago
You don’t have to stack -v like that: -v inverts all the -e expressions, so this should be equivalent:
grep -inHv -e foo -e bar -e baz
- fiddlerwoaroof 5y agoSo, awk sort of works as a fancy grep: ps axjw | awk '(/zsh/ || /login/) && !(/awk/ || /direnv/)' And you can easily add features like "print the first line unconditionally: ps axjw | awk 'NR == 1 {print} (/zsh/ || /login/) && !(/awk/ || /direnv/)' IMO, awk is in a pretty uniquely sweet spot between grep and perl/ruby/python.
- henshao 5y agoThanks for the grep tip! Unfortunately I've not put in the effort to learn awk past printing the n-th column of ls (my typical use) - the extra syntax required to properly 'quote' and {} things puts me off.