cargl - Linux
Overview
cargl is a command-line utility designed for efficient and flexible data manipulation in a CSV (Comma-Separated Values) format. It offers powerful tools for filtering, sorting, aggregating, and analyzing large CSV datasets with ease.
Syntax
cargl [options] <commands> <input-file> <output-file>
Options/Flags
| Option | Description | Default Value |
|—|—|—|
| -f, --filter
| Filters the input data based on a specified condition | None |
| -s, --sort
| Sorts the input data by one or more columns | None |
| -g, --group
| Group the data by one or more columns | None |
| -a, --aggregate
| Performs aggregation operations (sum, count, average) on specific columns | None |
| -d, --delimiter
| Specifies the delimiter character separating data fields | ‘,’ |
| -q, --quiet
| Suppresses all non-essential output during the operation | False |
| -h, --help
| Displays help information | None |
Examples
Example 1: Filter data
cargl -f "age > 30" input.csv output.csv
Example 2: Sort data
cargl -s "age DESC" -s "name ASC" input.csv output.csv
Example 3: Aggregate and group data
cargl -g "dept" -a "sum(salary)" input.csv output.csv
Common Issues
- Invalid filter expression: Ensure that the filter condition is formatted correctly using the valid syntax.
- Incompatible input file: Verify that the input file is a valid CSV file with the specified delimiter.
- Duplicate output file: Specify a unique output filename if the output file already exists.
Integration
cargl can be integrated with other commands using pipes:
cat input.csv | cargl -f "age > 30" | sort -k 2
Related Commands
- csvkit – A suite of command-line tools for CSV data manipulation
- pandas – A Python library for data analysis and manipulation
- jq – A command-line JSON processor