4 ms·
> `egrep 'PATTERN|PATTERN'` instead of `grep PATTERN | grep PATTERN` Oops? Ironically (assuming two distinct values of PATTERN) I think you just answered your
by zwp 11y ago
> `egrep 'PATTERN|PATTERN'` instead of `grep PATTERN | grep PATTERN`
Oops? Ironically (assuming two distinct values of PATTERN) I think you just answered your own question. (They are different: first is disjunction of patterns, second is conjunction).
Your point has merit for scripts (performance) but for data exploration at the prompt it's almost always irrelevant: the simplicity of pipe composition outweighs anything else.
- brbsix 11y agoWhoops you've got me there. Yes for that example, the grep alternative is not very elegant. Anyways I wasn't making an argument against composition, just particular types of composition (such as useless use of cat, parsing ls, grepping ps) for which there are side-effects or there is a simpler or more appropriate alternative.