3 ms·
Instead of using a cat with heredoc, just type cat - | grep "something" And control-d when finished entering text
by mhitza 15y ago
Instead of using a cat with heredoc, just type
cat - | grep "something"
And control-d when finished entering text
- gnosis 15y agoYou don't need the dash. This is enough: cat | grep "something"
- comex 15y agoOr just grep "something"
- veyron 15y agoIn some older versions of bash, when dealing with process substitution, you actually needed the dash. For example get_data | tee >(cmd) get_data | tee >(cat | cmd) would fail but get_data | tee >(cat - | cmd) would succeed.
- 16s 15y agoWhen I was young, I used cat and grep like that until an old Unix sys-admin remarked "What a gratuitous use of cat!". At the time, I did not understand what he meant, but now I do. So whenever I see cat and grep used like this, I think back to that lesson I learned.