|
|
|
|
|
by thaumasiotes
2311 days ago
|
|
But that is a case where you have several filenames and you want to concatenate the files. The work you're using cat to do is to locate and read the files based on the filename. If you already have the data stream(s), cat does nothing for you; you have to choose the order you want to read them in, but that's also true when you invoke cat. This is the conceptual difference between pipeline | cat # does nothing
and pipeline | xargs cat # leverages cat's ability to open files
Opening files isn't really something I think of cat as doing in its capacity as cat. It's something all the command line utilities do equally. |
|
Also, if you have multiple data streams, by using e.g. explicit file descriptor redirection in your shell, ala
...then cat(1) won’t even help you there. No tooling from POSIX or GNU really supports consuming those streams, AFAIK.But it’s pretty simple to instead target the streams into explicit fifo files, and then concatenate those with cat(1).