Hi,
I am having a file (file1) having following contents
" xet B - All Divers/All Rivers - - ns - "
Now when i use
cat file1 | grep 'RF'
it doesn't returns anything.
But on using
cat file1 | grep 'RF*'
shows me this complete line
But in this file there is no word RF, then why grep is showing me this complete line on using RF*.
Thanks
Sarbjit
pludi
2
From the man page of grep:
So
grep 'RF*'
means "search for an uppercase R, followed by 0 or more uppercase F", which matches the 'R' in 'Rivers'.
zaxxon
3
Because a * stands for "none or any number of the previous character". So a simple "R" in your input is a match.
When using grep, you don't need to pipe input via cut. Just do
grep RF* file1
Also in this case "*" is not a wildcard, it's a modifier.
clx
5
Also, In regular expression terms, it is called as quantifiers.
"?" and "+" are the other two.
Yes, but as far as I know "?" and "+" are not supported in BRE (grep's default).