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 makes the search case-insensitive?
Answer: -i
The -i option tells grep to ignore case differences when matching patterns.
What does the `cut -d: -f1` command do when processing /etc/passwd?
Answer: Prints the first field using colon as delimiter
cut -d: sets the delimiter to colon and -f1 selects the first field from each line.
Which command would you use to sort a file's lines in reverse alphabetical order?
Answer: sort -r file
The sort -r option reverses the default sort order, producing reverse alphabetical output.
What is the purpose of the `wc -l` command?
Answer: Count lines in a file
wc -l counts the number of newline-terminated lines in the input.
Which sed command deletes all lines containing the word 'error'?
Answer: sed '/error/d' file
In sed, /pattern/d means 'delete lines that match the pattern'.
What does `grep -c 'pattern' file` output?
Answer: The count of matching lines
grep -c prints only the count of lines that match the given pattern.
Which command extracts characters 3 through 7 from each line of a file?
Answer: cut -c3-7 file
cut -c uses character positions; -c3-7 selects characters 3 through 7 from each line.