The ‘paste’ command will merge multiple files line by line, and you can declare a delimiter between the files’ contents.
This would be really useful for, say, creating a CSV using the contents of multiple files. You could run the following command and instantly create a CSV.
$ paste -d',' column1.txt column2.txt
Another use I have found recently is to help generate large SQL create table statements. For instance, say that I have two files. File ‘file_a.txt’ has the following contents (SQL types).
INT INT STRING DOUBLE STRING STRING
File ‘file_b.txt’ has the corresponding SQL column names.
width length name cost comment1 comment2
I can form a create table SQL statement in Bash very quickly using paste:
$ echo -e "CREATE TABLE my_table (\n$(paste -d' ' file_a.txt file_b.txt))" CREATE TABLE my_table ( INT width INT length STRING name DOUBLE cost STRING comment1 STRING comment2)