tldr/pages/common/paste.md

25 lines
640 B
Markdown
Raw Normal View History

2015-12-30 03:41:32 +00:00
# paste
> Merge lines of files.
> More information: <https://www.gnu.org/software/coreutils/paste>.
2015-12-30 03:41:32 +00:00
- Join all the lines into a single line, using TAB as delimiter:
2015-12-30 03:41:32 +00:00
2022-12-04 09:12:49 +00:00
`paste -s {{path/to/file}}`
2015-12-30 03:41:32 +00:00
- Join all the lines into a single line, using the specified delimiter:
2015-12-30 03:41:32 +00:00
2022-12-04 09:12:49 +00:00
`paste -s -d {{delimiter}} {{path/to/file}}`
2015-12-30 03:41:32 +00:00
- Merge two files side by side, each in its column, using TAB as delimiter:
2015-12-30 03:41:32 +00:00
`paste {{file1}} {{file2}}`
- Merge two files side by side, each in its column, using the specified delimiter:
2015-12-30 03:41:32 +00:00
`paste -d {{delimiter}} {{file1}} {{file2}}`
- Merge two files, with lines added alternatively:
2015-12-30 03:41:32 +00:00
`paste -d '\n' {{file1}} {{file2}}`