Linux command
paste 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Merge files side by side
paste [file1.txt] [file2.txt]
Merge with custom delimiter
paste -d "," [file1.txt] [file2.txt]
Merge lines from single file
paste -s [file.txt]
Create tab-separated columns
paste - - < [file.txt]
Merge multiple files
paste [file1] [file2] [file3]
说明
paste merges lines from multiple files side by side. Each line from the first file is joined with the corresponding line from subsequent files, separated by tabs. The tool is useful for combining data from different sources into columnar format.
参数
- -d _list_
- Use characters from list as delimiters.
- -s, --serial
- Paste one file at a time.
- -z, --zero-terminated
- Use NUL as line delimiter.
- --help
- Display help.
- --version
- Display version.
FAQ
What is the paste command used for?
paste merges lines from multiple files side by side. Each line from the first file is joined with the corresponding line from subsequent files, separated by tabs. The tool is useful for combining data from different sources into columnar format.
How do I run a basic paste example?
Run `paste [file1.txt] [file2.txt]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -d _list_ do in paste?
Use characters from list as delimiters.