a cross-platform, efficient and practical CSV/TSV toolkit, it is forked from this repo, but we added more subcommands like
jsbased filtering and enhanced some other commands, also we'are planing to add more commands to it, you can find the origional documentation here plus this README that documents the added commands.
Similar to FASTA/Q format in field of Bioinformatics, CSV/TSV formats are basic and ubiquitous file formats in both Bioinformatics and data sicence.
People usually use spreadsheet softwares like MS Excel to do process table data. However it's all by clicking and typing, which is not automatically and time-consuming to repeat, especially when we want to apply similar operations with different datasets or purposes.
You can also accomplish some CSV/TSV manipulations using shell commands, but more codes are needed to handle the header line. Shell commands do not support selecting columns with column names either.
csvtk is convenient for rapid data investigation
and also easy to be integrated into analysis pipelines.
It could save you much time of writing Python/R scripts.
- Features
- Subcommands
- Installation
- Bash-completion
- Compared to
csvkit - Examples
- Acknowledgements
- Contact
- License
- Light weight and out-of-the-box, no dependencies, no compilation, no configuration
- Fast, multiple-CPUs supported
- Practical functions supported by N subcommands
- Support STDIN and gziped input/output file, easy being used in pipe
- Most of the subcommands support unselecting fields and fuzzy fields,
e.g.
-f "-id,-name"for all fields except "id" and "name",-F -f "a.*"for all fields with prefix "a.". - Support some common plots (see usage)
Seamlessly support for data with meta line (e.g.,sep=,) of separator declaration used by MS Excel
+30 subcommands in total.
Information
headersprint headersstatssummary of CSV filestats2summary of selected digital fields
Format conversion
prettyconvert CSV to readable aligned tablecsv2tabconvert CSV to tabular formattab2csvconvert tabular format to CSVspace2tabconvert space delimited format to CSVtransposetranspose CSV datacsv2mdconvert CSV to markdown formatxlsx2csvconvert XLSX to CSV format
Set operations
headprint first N recordsconcatconcatenate CSV/TSV files by rowssamplesampling by proportioncutselect parts of fieldsgrepgrep data by selected fields with patterns/regular expressionsuniqunique data without sortingfreqfrequencies of selected fieldsinterintersection of multiple filesfilterfilter rows by values of selected fields with arithmetic expressionfilter2filter rows by awk-like arithmetic/string expressionsjoinjoin multiple CSV files by selected fieldssplitsplit CSV/TSV into multiple files according to column valuessplitxlsxsplit XLSX sheet into multiple sheets according to column valuescollapsecollapse one field with selected fields as keys
Edit
renamerename column namesrename2rename column names by regular expressionreplacereplace data of selected fields by regular expressionreplace2replace data of selected fields using javascript function.mutatecreate new columns from selected fields by regular expressionmutate2create new column from selected fields by awk-like arithmetic/string expressionsgathergather columns into key-value pairs
Ordering
sortsort by selected fields
Ploting
plotsee usageplot histhistogramplot boxboxplotplot lineline plot and scatter plot
Misc
versionprint version information and check for updategenautocompletegenerate shell autocompletion script