sortcheck
The sortcheck
command checks if a CSV file is sorted based on a specified column.
Syntax
qsv sortcheck [options] <column> <input_file>
Description
The sortcheck
command is used to check if a CSV file is sorted based on a specified column. This is useful for verifying the order of data.
Options
-r, --reverse
: Check if sorted in reverse order--no-headers
: When set, the first row will not be interpreted as headers
Exit Codes
- 0: File is sorted
- 1: File is not sorted
- Non-zero: An error occurred
Examples
Check if Sorted
Check if rows are sorted by the transaction_id
column:
qsv sortcheck transaction_id DLD_Transactions_English_500.csv
Check if Sorted in Reverse Order
Check if rows are sorted in reverse order by the transaction_id
column:
qsv sortcheck -r transaction_id DLD_Transactions_English_500.csv
Common Use Cases
- Verifying the order of data
- Preparing data for analysis
Tips
- Verify the output to ensure the data is correctly checked
- Use in combination with other commands for complex data processing