Ratikant Samal
Ratikant Samal

Reputation: 31

Word search using grep command in Linux

Suppose I have a file named as test.txt having content . I want to find the line containing the words starting with "r" character and ending with "i" character?

Upvotes: 0

Views: 219

Answers (1)

paxdiablo
paxdiablo

Reputation: 881103

That would be something like:

grep '\b[Rr][A-Za-z]*[Ii]\b' test.txt

That's case insensitive so, if you want to ensure specific capitalisation, you would adjust the individual character classes in the expression.

Upvotes: 1

Related Questions