โ† All 010-160 Flashcard Decks

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
  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

  7. 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.