Command line utilities I didn't know of: `paste`

Have you ever had two lists and you wanted to print their elements side by side? Well, if that’s the case, then the paste command is for you.

In fact, it’s the opposite of the cat command: While cat concatenates the lines of multiple files vertically (i.e. sequentally), paste assembles them horizontally. For instance, you have two lists:

# one.list
1
2
3
# two.list
a
b
c

With paste one.list two.list, you get this:

1   a
2   b
3   c

Apart from that, there are few options: With the -d flag you can set another delimiter than the default tab. -s transposes the result:

# paste -s one.list two.list
1   2   3
a   b   c

Simple but useful.


119 Words

2019-07-20 08:50 +0000

dfe4785 @ 2019-07-20