nerdexam
LPI

101-500 · Question #284

You want to search the file myfile for all occurances of string containing at least five characters, where character number 2 and 5 are 'a' and character number 3 is NOT 'b'. Which command would you…

The correct answer is B. grep .a[^b].a myfile. You've hit your Sonnet limit · resets Jun 8, 9am (UTC)

GNU and Unix Commands

Question

You want to search the file myfile for all occurances of string containing at least five characters, where character number 2 and 5 are 'a' and character number 3 is NOT 'b'. Which command would you use?

Options

  • Agrep a*^b*a myfile
  • Bgrep .a[^b].a myfile
  • Cgrep .[a].*.[a] myfile
  • Dgrep .a*^b..a myfile

How the community answered

(33 responses)
  • A
    9% (3)
  • B
    82% (27)
  • C
    3% (1)
  • D
    6% (2)

Explanation

You've hit your Sonnet limit · resets Jun 8, 9am (UTC)

Topics

#grep#regex patterns#character classes#text matching

Community Discussion

No community discussion yet for this question.

Full 101-500 Practice