You have a CSV file named sales.csv whose records are formatted as Date,Region,Amount (for example:
2025-06-01,West,1750
2025-06-01,East,980
). Management wants the file sorted first alphabetically by the Region field and, within each region, by the Amount field in descending numeric order. Which single sort command will produce the required output and write it to standard output?
The command that works must do four things in the correct order:
Tell sort that the field separator is a comma (-t',').
Define the primary key as field 2 (Region) in its default ascending, alphabetical order (-k2,2).
Define a secondary key as field 3 (Amount), interpreted numerically and sorted in reverse (descending) order (-k3,3nr).
Specify the input file name.
The command sort -t',' -k2,2 -k3,3nr sales.csv satisfies all of these requirements. The other options fail because they either reverse the Region sort, sort Amounts in the wrong (ascending) direction, or ignore the Region key entirely.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the '-t','' flag do in the sort command?
Open an interactive chat with Bash
What does the '-k' option mean in the sort command?
Open an interactive chat with Bash
Why is the '-k3,3nr' flag used for sorting the Amount field?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
System Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .