134k views
4 votes
What are other wildcards when using grep? (ex. begins with / ends with)

User Nazmul
by
7.2k points

1 Answer

2 votes

Final answer:

Grep wildcards include ., *, ?, and [ ].

Step-by-step explanation:

When using the grep command, there are several wildcards you can use to search for patterns in a text. Some of the common wildcards include:

  • `.`: Matches any single character.
  • `*`: Matches zero or more occurrences of the previous character.
  • `?`: Matches zero or one occurrence of the previous character.
  • `[ ]`: Matches any one character specified within the bracket.

For example, to search for all words starting with the letter 'a', you can use the command grep '^a' filename. To search for words ending with 'ing', you can use grep 'ing$' filename.

User Felix Av
by
7.8k points