Recall & Review
beginner
What does the
-E option do in the grep command?The
-E option tells grep to use extended regular expressions (ERE), allowing more powerful pattern matching without needing to escape some special characters.Click to reveal answer
beginner
How is
grep -E different from basic grep?Basic
grep uses basic regular expressions (BRE) where some characters like ?, +, and {} need escaping. grep -E uses extended regex where these characters work directly.Click to reveal answer
beginner
Example: What does
grep -E 'cat|dog' file.txt do?It searches
file.txt for lines containing either 'cat' or 'dog'. The | means OR in extended regex.Click to reveal answer
intermediate
Why use
grep -E instead of egrep?egrep is an older command equivalent to grep -E. Modern systems recommend using grep -E because egrep may be deprecated.Click to reveal answer
beginner
How to match one or more digits using
grep -E?Use
grep -E '[0-9]+'. The + means 'one or more' of the previous character or group.Click to reveal answer
What does the command
grep -E 'a+b' file.txt match?✗ Incorrect
The
+ means one or more 'a's before 'b' in extended regex.Which symbol means OR in
grep -E regex?✗ Incorrect
The pipe
| means OR in extended regular expressions.What is the difference between
grep and grep -E?✗ Incorrect
grep -E enables extended regex features.Which command is recommended for extended regex searching?
✗ Incorrect
grep -E is the modern recommended way to use extended regex.How to match zero or one occurrence of 'a' using
grep -E?✗ Incorrect
The
? means zero or one occurrence in extended regex.Explain how to use
grep -E to search for lines containing either 'apple' or 'orange' in a file.Think about how to combine two words with OR in regex.
You got /4 concepts.
Describe the difference between basic and extended regular expressions in the context of
grep.Focus on special characters and how they behave.
You got /4 concepts.