September 2018
Beginner
186 pages
4h 30m
English
Sometimes, you may want to add header or footer information to a stream in a pipeline, perhaps read from another file. One straightforward way of doing this is using cat for its intended purpose of concatenating streams of input.
Normally, cat combines all of the filenames specified in its arguments and writes them to standard output, in the same order they were specified:
$ cat myfile1 myfile2 myfile3 > myfiles.combined
We can use the special value of a single hyphen (-) anywhere among the cat filename arguments to denote that any standard input to cat should be added at that point. For example, if we had a generate-html command that generated the body of an HTML document, we might want to add the headers ...
Read now
Unlock full access