Skip to main content
2 of 4
added 2 characters in body
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

The command you're looking for is grep, and the regular expression you want is ^b.*[ig].*o$.

grep is used like

grep 'EXPRESSION' INPUT-FILES

and will output the lines matching EXPRESSION to its standard output (the terminal, in this case).

  • The ^ anchors the expression to the start of the line, and the $ does the same but to the end.

  • . matches any single character and * matches any number of the previous expression, so .* matches any number (including zero) of any character.

  • [ig] will match a single i or g.

  • All other characters (b and o) in this particular regular expression matches themselves.

Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k