grep question

From: John Entwistle (jentwistle@twcny.rr.com)
Date: Wed Dec 15 2004 - 12:24:55 EST


Hello all,

I apologize if this is not the proper forum for this simple question,
but here goes. Let's say my /etc/hosts file is as follows:

10.1.1.2 hostname
10.1.1.3 hostname.old
10.1.1.4 hostname.mgt
10.1.1.5 hostname.

I want to list only those lines that contain "hostname" only without
anything else appearing after the word. In Linux, I would do the
following:

grep hostname$ /etc/hosts
or
grep -w hostname$ /etc/hosts

Doing so gives me the desired output:
   10.1.1.2 hostname

However, when I issue "grep hostname$ /etc/hosts" on Solaris all 4
entried are returned. Doing a "grep -w hostname /etc/hosts" returns
the first and last lines (hostname and hostname.). ????

What is the proper Solaris grep command to retrieve the desired output?

Thanks!
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:29:52 EDT