I am looking for a bash one-liner which can cat
a number of files with a number of fixed lines.
file1.txt:
file1 line 1
file1 line 2
file2.txt
file2 line 1
file2 line 2
Then I am looking for something like
cat-with-strings foo file1.txt bar file2.txt baz
producing output
foo
file1 line 1
file1 line 2
bar
file2 line 1
file2 line 2
baz
How can I do this in a single line of bash, using standard linux tools (sed, awk, cat, etc) and without creating any files to hold foo
, bar
, or baz
?