Bird
0
0

You want to find lines in users.txt where the username starts with a vowel and ends with a digit. Which grep -E command achieves this?

hard📝 Application Q8 of 15
Linux CLI - Text Processing
You want to find lines in users.txt where the username starts with a vowel and ends with a digit. Which grep -E command achieves this?
Agrep -E '^[aeiouAEIOU].*[0-9]$' users.txt
Bgrep -E '^[0-9].*[aeiouAEIOU]$' users.txt
Cgrep -E '[aeiouAEIOU].*[0-9]' users.txt
Dgrep -E '^[aeiouAEIOU][0-9]$' users.txt
Step-by-Step Solution
Solution:
  1. Step 1: Define pattern for start and end

    Start with vowel: ^[aeiouAEIOU], end with digit: [0-9]$, with any characters in between: .*.
  2. Step 2: Check other options

    grep -E '^[0-9].*[aeiouAEIOU]$' users.txt reverses start and end; C lacks anchors; D matches only two characters (vowel then digit) exactly.
  3. Final Answer:

    grep -E '^[aeiouAEIOU].*[0-9]$' users.txt -> Option A
  4. Quick Check:

    Use ^ and $ to anchor start and end [OK]
Quick Trick: Use ^ for start, $ for end, .* for any chars in between [OK]
Common Mistakes:
  • Mixing start and end anchors
  • Forgetting to anchor pattern
  • Matching only two characters instead of whole line

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes