Linux command
csvkit 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Display CSV file
csvlook [data.csv]
Get statistics
csvstat [data.csv]
Select specific columns
csvcut -c [col1,col2] [data.csv]
Sort by a column
csvsort -c [column] [data.csv]
Query CSV with SQL
csvsql --query "[SELECT * FROM data WHERE id > 100]" [data.csv]
Filter rows
csvgrep -c [column] -m "[value]" [data.csv]
Convert an Excel file to CSV
in2csv [data.xlsx] > [data.csv]
Stack multiple CSV files
csvstack [file1.csv] [file2.csv]
说明
csvkit is a comprehensive suite of command-line tools for working with CSV files. It brings database-like operations to tabular data without requiring a database, following Unix philosophy principles. The tools handle CSV quoting and escaping correctly, avoiding the pitfalls of using awk, sed, or cut directly on CSV data. They support various input encodings and delimiters, making them versatile for real-world data processing. csvkit is particularly useful for data journalism, quick data exploration, ETL processes, and as part of data pipelines. All tools can read from stdin and write to stdout for easy chaining.
FAQ
What is the csvkit command used for?
csvkit is a comprehensive suite of command-line tools for working with CSV files. It brings database-like operations to tabular data without requiring a database, following Unix philosophy principles. The tools handle CSV quoting and escaping correctly, avoiding the pitfalls of using awk, sed, or cut directly on CSV data. They support various input encodings and delimiters, making them versatile for real-world data processing. csvkit is particularly useful for data journalism, quick data exploration, ETL processes, and as part of data pipelines. All tools can read from stdin and write to stdout for easy chaining.
How do I run a basic csvkit example?
Run `csvlook [data.csv]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
Where can I find more csvkit examples?
This page includes 8 examples for csvkit, plus related commands for nearby Linux tasks.