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 command would display only lines that do NOT match a pattern in grep?
Answer: grep -v pattern file
grep -v inverts the match, printing only lines that do not contain the pattern.
What is the default field separator used by the `sort` command?
Answer: Whitespace
By default, sort treats any whitespace (spaces or tabs) as a field separator.
Which sed command replaces only the first occurrence of 'foo' with 'bar' on each line?
Answer: sed 's/foo/bar/' file
Without the g flag, sed s/// replaces only the first match on each line.
What does `head -n 20 file.txt` display?
Answer: The first 20 lines of file.txt
head -n 20 prints the first 20 lines of the specified file.
Which command finds all files with the .conf extension under /etc?
Answer: find /etc -name '*.conf'
find /etc -name '*.conf' searches /etc for files whose names match the *.conf glob.
What does `wc -w file.txt` count?
Answer: Words in the file
wc -w counts the number of words (whitespace-delimited tokens) in the file.
Which pipe chain counts the number of unique lines in a file?
Answer: sort file | uniq | wc -l
Sorting first groups duplicates together, then uniq removes them, and wc -l counts what remains.