Hello - Sorry, I'm new at UNIX and regex and even the simplest of issues seem to be throwing me.
Can someone explain this to me:
In a file f1 this line is contained:
MH76M*ME5G4GCKOVICHJEFFREY0187405......
The command
grep MH76M*M f1
yields the line, as I would expect. I read this as MH76 followed by 0 or more 'M's, then another M.
However, if I use
grep MH76M*ME f1
no line is found. How can this be?
Also, if I use
grep MH76M\*M f1
grep MH76M\*ME f1
or
grep 'MH76M*M' f1
grep 'MH76M*ME' f1
I get the same results, in both pairs, the first command yields the line, the second one does not. I thought the backslash or the ticks should be escaping the asterisk and looking for a literal asterisk in the file, so both of these should work as well, as there is an asterisk in that line in the file immediately following the '76M'.
Thanks.
Can someone explain this to me:
In a file f1 this line is contained:
MH76M*ME5G4GCKOVICHJEFFREY0187405......
The command
grep MH76M*M f1
yields the line, as I would expect. I read this as MH76 followed by 0 or more 'M's, then another M.
However, if I use
grep MH76M*ME f1
no line is found. How can this be?
Also, if I use
grep MH76M\*M f1
grep MH76M\*ME f1
or
grep 'MH76M*M' f1
grep 'MH76M*ME' f1
I get the same results, in both pairs, the first command yields the line, the second one does not. I thought the backslash or the ticks should be escaping the asterisk and looking for a literal asterisk in the file, so both of these should work as well, as there is an asterisk in that line in the file immediately following the '76M'.
Thanks.