Searching and Extracting Data Flashcards
7 cards from real 010-160 practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Searching and Extracting Data flashcards as text
Which grep option uses extended regular expressions without needing to escape special characters like `+` or `|`?
Answer: grep -E
grep -E (or egrep) enables extended regular expressions, allowing unescaped use of +, |, (, and ).
What does `find . -type d` search for?
Answer: Directories only
The -type d predicate restricts find results to directories.
Which command sorts a file numerically by the second field, using a comma as delimiter?
Answer: sort -t, -k2 -n file
sort -t, sets comma as delimiter, -k2 selects the second field, and -n sorts numerically.
What is the effect of `tr -d '\n'` on its input?
Answer: Deletes all newline characters from the input
tr -d deletes every occurrence of the specified character; here it removes all newline characters.
Which command finds files that were accessed more than 7 days ago?
Answer: find . -atime +7
find -atime +7 finds files whose last access time was more than 7 days ago.
What does the `grep -l 'error' *.log` command output?
Answer: Only the names of .log files that contain 'error'
grep -l prints only the filenames of files that contain at least one match, not the matching lines.
Which pipeline lists the ten most frequently occurring words in a text file?
Answer: cat file | sort | uniq -c | sort -rn | head -10
Splitting into words, counting with uniq -c, reverse-numeric sorting, then head -10 gives the top 10 most frequent words.