Reputation:
I'm having trouble finding what the *
does in the grep command. I'm following this example:
ian@attic4:~/lpi103-7$ grep "p*" text1
1 apple
2 pear
3 banana
Why does banana
appear if p*
is there?
Upvotes: 0
Views: 122
Reputation: 613
The *
symbol means "0 or more times", so the p
character does not need to be in the line for it to be matched. If you want the p
character to appear at least one time, use +
instead.
Upvotes: 1