In addition to cuonglm's answer:
:|paste -sd'\n' $(sed $"s/\s/ - - /g" <<< $(ls -1|paste -sd" " -))
For this to work you need to have all files, that should be concatenated within one folder and at it's best sorted alphanumerical.
The output can then be redirectet to a file.
Whats happening here?
:
That's the true function in bash. This mostly is used for no-ops as it returns just true.
|
Thats a pipe, which takes the output of the left command and pipes it in the input of the right command.
$(sed $"s/\s/ - - /g" <<< $(ls -1|paste -sd" " -))
This just builds the line that is needed for paste. It will look something like
file1 - - file2 - - file3 - - file4 ...
So when paste is called it will write all lines from the listed files to standard output. When a file isn't found or called "-" paste reads from standard input and get's the TRUE value from : which is piped into paste.
Normally every file is appended a tab operator after is has been written to stdout. with the -d"\n" argument for paste the tab is exchanged with a newline.
So now paste writes the files seperated with newlines to stdout and when paste finds a "-" it takes the true and only writes the seperator to stdout - the newline.