paste
Text processing
Usage
paste [file1] [file2]Glues files together side by side with a tab between them; unlike join it matches lines by position and never looks at their content.
Common flags
| Flag | Meaning |
|---|---|
| -d | Which characters to put between the columns, used in turn |
| -s | Put all lines of a file onto one line |
| - | Read standard input, once for each column you want |
Examples
paste names.txt scores.txtThe two files side by side, tab separated.
paste -sd, list.txtTurns a list of lines into one comma-separated line.
paste - - < pairs.txtFolds every two lines into one.
These were built to be piped together. Three joined commands are usually shorter than one that does everything.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does paste do?
Glues files together side by side with a tab between them; unlike join it matches lines by position and never looks at their content.
Q. How do I type it?
paste [file1] [file2] — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
3 are listed here; the full set is in man paste. This command sits under Text processing.
Related commands
man page: man paste