Bird
0
0

Which of the following is the correct syntax to replace all lowercase 'a' characters with 'b' using tr?

easy📝 Syntax Q12 of 15
Linux CLI - Text Processing
Which of the following is the correct syntax to replace all lowercase 'a' characters with 'b' using tr?
Atr -replace a b
Btr a-z b
Ctr 'a' 'b'
Dtr 'a' to 'b'
Step-by-Step Solution
Solution:
  1. Step 1: Recall tr syntax

    The correct syntax uses single quotes around the sets of characters: tr 'a' 'b'.
  2. Step 2: Evaluate options

    tr a-z b uses a range which translates all lowercase letters to 'b' (padded), incorrect for only 'a'. Options A and C use invalid syntax for tr.
  3. Final Answer:

    tr 'a' 'b' -> Option C
  4. Quick Check:

    Use quotes around sets in tr [OK]
Quick Trick: Use quotes around characters in tr command [OK]
Common Mistakes:
  • Using range 'a-z' for single character
  • Using invalid options like -replace
  • Adding extra words like 'to'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes