Bird
0
0

If list1.txt contains:

medium📝 Command Output Q4 of 15
Bash Scripting - Text Processing in Scripts
If list1.txt contains:
cat
dog
mouse

and list2.txt contains:
black
brown
grey

What will be the output of paste -d '-' list1.txt list2.txt?
Acat dog mouse black brown grey
Bcat-black dog-brown mouse-grey
Ccat black dog brown mouse grey
Dcatblack dogbrown mousegrey
Step-by-Step Solution
Solution:
  1. Step 1: Understand the paste command

    The paste command merges lines of files side by side.
  2. Step 2: Use the delimiter option

    The -d '-' option sets the delimiter between pasted lines to a hyphen.
  3. Step 3: Apply to given files

    Each line from list1.txt is joined with the corresponding line from list2.txt separated by '-'.
  4. Final Answer:

    cat-black dog-brown mouse-grey -> Option B
  5. Quick Check:

    Check delimiter and line pairing [OK]
Quick Trick: paste joins lines side-by-side with specified delimiter [OK]
Common Mistakes:
MISTAKES
  • Assuming paste concatenates files vertically
  • Forgetting to specify delimiter with -d
  • Expecting space as default delimiter

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes