[WBEL-users] grep help
William Hooper
whooperhsd2@earthlink.net
Tue, 14 Dec 2004 11:51:30 -0500 (EST)
Timothy Nash said:
[snip]
> It works for me on my linux box as well. A friend of mine asked me this
> question - not sure exactly what he's trying to do. I just found out he's
> using Solaris. Anyone know why Solaris treats periods differently than
> Linux.
Nope, but...
> When he issues any of the following commands:
>
>
> grep -w "hostname" hosts
> grep -w 'hostname' hosts
> grep -w hostname hosts
These commands are correct to return both lines (and in the original
example, all 4 lines). The command that works is:
grep hostname$ hosts
This works because the "$" is a metacharacter that means "at the end of a
line". Perhaps the Solaris grep is a different version?
--
William Hooper