3 ms·
This form is also nicely modular, setting up a data source at the left of the pipe in a way that's easy to modify to swap in a different kind of data source:
by _delirium 13y ago
This form is also nicely modular, setting up a data source at the left of the pipe in a way that's easy to modify to swap in a different kind of data source:
cat file | grep xyz
gzcat file | grep xyz
xzcat file | grep xyz
pv file | grep xyz
curl url | grep xyz
There are many places I get data, and it sometimes changes (e.g. I decide to compress a file and read it back with xzcat instead of cat, leaving the rest of the script unchanged). Unless you give me an alternate syntax that can handle all of them, I'm not interested in the fact that a particular utility has chosen to provide its own idiosyncratic syntax to special-case only the 'cat' data source, with an -f parameter or whatever.
- LukeShu 13y ago> setting up a data source at the left of the pipe in a way that's easy to modify to swap in a different kind of data source: Just replace cat file | with <file It still keeps the data source on the left, and easily swapped out: <file grep xyz