Bird
0
0

What will be the output of the command:

medium📝 Command Output Q5 of 15
Linux CLI - Text Processing
What will be the output of the command:
echo "apple|banana|cherry" | cut -d '|' -f 1,3?
Aapple|cherry
Bapple|banana
Cbanana|cherry
Dapple,cherry
Step-by-Step Solution
Solution:
  1. Step 1: Understand delimiter and fields

    The delimiter is '|', and fields 1 and 3 are requested.
  2. Step 2: Extract fields 1 and 3

    Field 1 is 'apple', field 3 is 'cherry'. The output joins them with the delimiter '|'.
  3. Final Answer:

    apple|cherry -> Option A
  4. Quick Check:

    Fields 1 and 3 with '|' delimiter = apple|cherry [OK]
Quick Trick: Multiple fields keep original delimiter in output [OK]
Common Mistakes:
  • Assuming output uses commas
  • Extracting wrong fields
  • Using wrong delimiter

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes