8 个版本
0.0.8 | 2024年5月20日 |
---|---|
0.0.7 | 2024年5月15日 |
0.0.5 | 2024年4月26日 |
0.0.1 | 2023年10月8日 |
1949 在 命令行工具 中
每月 84 次下载
68KB
2K SLoC
xtab
🦀 CSV 命令行工具
安装
步骤1:首先安装 cargo
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
步骤2
cargo install xtab
# or
git clone https://github.com/sharkLoc/xtab.git
cd xtab
cargo b --release
# mv target/release/xtab to anywhere you want
用法
xtab -- CSV command line utilities
Version: 0.0.8
Authors: sharkLoc <[email protected]>
Source code: https://github.com/sharkLoc/xtab.git
xtab supports reading and writing gzip/bzip2/xz format file.
Compression level:
format range default crate
gzip 1-9 6 https://crates.io/crates/flate2
bzip2 1-9 6 https://crates.io/crates/bzip2
xz 1-9 6 https://crates.io/crates/xz2
Usage: xtab [OPTIONS] [CSV] <COMMAND>
Commands:
addheader Set new header for CSV file [aliases: ah]
csv2xlsx Convert CSV/TSV files to XLSX file [aliases: c2x]
dim Dimensions of CSV file
drop Drop or Select CSV fields by columns index
flatten flattened view of CSV records [aliases: flat]
freq Build frequency table of selected column in CSV data
head Print first N records from CSV file
pretty Convert CSV to a readable aligned table [aliases: prt]
replace Replace data of matched fields
reverse Reverses rows of CSV data [aliases: rev]
sample Randomly select rows from CSV file using reservoir sampling
search Applies the regex to each field individually and shows only matching rows
slice Slice rows from a part of a CSV file
tail Print last N records from CSV file
transpose Transpose CSV data [aliases: trans]
uniq Unique data with keys
xlsx2csv Convert XLSX to CSV format [aliases: x2c]
view Show CSV file content
help Print this message or the help of the given subcommand(s)
Global Arguments:
-d, --delimiter <CHAR> Set delimiter for input csv file, e.g., in linux -d $'\t' for tab, in powershell -d `t for tab [default: ,]
-D, --out-delimite <CHAR> Set delimiter for output CSV file, e.g., in linux -D $'\t' for tab, in powershell -D `t for tab [default: ,]
--log <FILE> If file name specified, write log message to this file, or write to stderr
--compress-level <INT> Set compression level 1 (compress faster) - 9 (compress better) for gzip/bzip2/xz output file, just work with option -o/--out [default: 6]
-v, --verbosity... control verbosity of logging, [-v: Error, -vv: Warn, -vvv: Info, -vvvv: Debug, -vvvvv: Trace, defalut: Debug]
[CSV] Input CSV file name, if file not specified read data from stdin
Global FLAGS:
-H, --no-header If set, the first row is treated as a special header row, and the original header row excluded from output
-q, --quiet Be quiet and do not show any extra information
-h, --help prints help information
-V, --version prints version information
Use "xtab help [command]" for more information about a command
依赖项
~19–34MB
~498K SLoC