Linux command
csv2tsv 命令
文本
涉及管道、覆盖或删除,执行前请先确认路径和参数。
常用示例
Convert CSV to TSV
csv2tsv [input.csv] > [output.tsv]
Convert from stdin
cat [input.csv] | csv2tsv > [output.tsv]
Convert with custom delimiter
csv2tsv -d "[;]" [input.csv]
Convert multiple files
csv2tsv [file1.csv] [file2.csv] > [combined.tsv]
Handle files with
csv2tsv --crlf [input.csv]
说明
csv2tsv converts comma-separated values (CSV) files to tab-separated values (TSV) format. TSV is often easier to process with Unix tools like cut, awk, and sort since tabs are less common in data than commas. The tool properly handles CSV quoting rules, preserving data integrity when fields contain commas, newlines, or quotes. Quoted fields are converted to unquoted TSV output where possible, with embedded tabs escaped if necessary. csv2tsv is useful as a preprocessing step for CSV data before using standard Unix text processing tools, or for importing data into systems that prefer tab-delimited input.
参数
- -d _CHAR_, --delimiter _CHAR_
- Input field delimiter (default: comma).
- --crlf
- Handle Windows-style line endings.
- -h, --help
- Display help information.
- -v, --version
- Display version information.
FAQ
What is the csv2tsv command used for?
csv2tsv converts comma-separated values (CSV) files to tab-separated values (TSV) format. TSV is often easier to process with Unix tools like cut, awk, and sort since tabs are less common in data than commas. The tool properly handles CSV quoting rules, preserving data integrity when fields contain commas, newlines, or quotes. Quoted fields are converted to unquoted TSV output where possible, with embedded tabs escaped if necessary. csv2tsv is useful as a preprocessing step for CSV data before using standard Unix text processing tools, or for importing data into systems that prefer tab-delimited input.
How do I run a basic csv2tsv example?
Run `csv2tsv [input.csv] > [output.tsv]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -d _CHAR_, --delimiter _CHAR_ do in csv2tsv?
Input field delimiter (default: comma).