Linux command
mlr 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Convert CSV to JSON
mlr --csv --ojson cat [data.csv]
Filter records
mlr --csv filter '$status == "active"' [data.csv]
Select fields
mlr --csv cut -f [name,email] [data.csv]
Sort records
mlr --csv sort -f [age] [data.csv]
Calculate statistics
mlr --csv stats1 -a mean -f [price] [data.csv]
Transform field
mlr --csv put '$total = $price * $quantity' [data.csv]
说明
mlr (Miller) processes structured text data. It handles CSV, JSON, and other formats. The tool provides awk-like processing for structured data. Powerful for data transformation.
参数
- --csv
- CSV format.
- --json
- JSON format.
- --ojson
- Output as JSON.
- filter
- Filter records.
- cut
- Select fields.
- sort
- Sort records.
- --help
- Display help information.
FAQ
What is the mlr command used for?
mlr (Miller) processes structured text data. It handles CSV, JSON, and other formats. The tool provides awk-like processing for structured data. Powerful for data transformation.
How do I run a basic mlr example?
Run `mlr --csv --ojson cat [data.csv]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --csv do in mlr?
CSV format.