So one can easily join files in bash with cat:
cat *.txt > all.txt
But what if one wants to insert something between the input files, like for example a linefeed?
|
So one can easily join files in bash with cat:
But what if one wants to insert something between the input files, like for example a linefeed? | |||
|
feedback
|
|
Requires GNU
append a line of 8 dashes and a newline after each file
You can use your sed '$d' with that Compare to these: Insert a line of dashes before each file:
Do the same, but without a newline after the dashes:
Put a line of dashes on the end of the last line of each file:
Surround each file with curly braces:
| |||||||
feedback
|
|
As a one-liner with subshells:
Here's what the subshell executes split into script-style lines: for i in *.txt do cat $i echo 'separator goes here' done In this example the separator acts like a footer; add a header by adding another | |||||||||||||||
feedback
|