bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep -


From: leondd1995
Subject: grep -
Date: Mon, 11 Feb 2008 11:17:49 -0800 (PST)

Hello,

not sure if this is a bug or not but here it is:

ypcat hosts | grep st[1-4]-nttd 

The above commant should pipe the stout of the ypcat hosts to grep and find any 
thing matching st (range of numbers 1 2 3 4) and ending with (-nttd)

To clarify the above command, I'm searching for hostnames that are any of the 
following:  st1-nttd, st2-nttd, st3-nttd, or st4-nttd.

Now...  if I run the command in any particular directory /, /root, /tmp/ etc... 
the commard properly provided a list of all host that met that st[1-4]-nttd - 
which is the four listed above.  

However, I unknowingly had an empty file named 'st1-nttd' (a file with the same 
name as one of the hosts I was greping for) while in /root.  I ran ypcat hosts 
| grep st[1-4]-nttd, from /root and the output only showed 'st1-nttd'.

I had thought I had an NIS problem originally but it turns out, after removing 
the file 'st1-nttd' for /root, and re-running ypcat hosts | grep st[1-4]-nttd, 
the problem was solved.  Sounds simple enough but it drove me crazy of an 
entire afternoon.

Is this a bug in grep or am I simply using bad syntax?

Thanks.
DL

       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]