It is currently Mon, 25 Sep 2023 10:34:11 GMT

Author Message
 grep problems - strange
Hey.  I'm working on a program to automate some sysadmin tasks, and have run
into something strange.  I'm using the command '/usr/xpg4/bin/grep
'^username:' /etc/passwd' to see if a username exists (actually I'm using
the -q option and checking the return code.)  It works with the passwd file.
If I use the same command on /etc/mail/aliases, it does not work!  Does
anyone know a reason why??


<please CC: to my email.  thank you>

 Sat, 02 Nov 2002 03:00:00 GMT   
 grep problems - strange
In comp.unix.solaris Brian Krahmer <> wrote:

one reason would be that the regexp you are searching for is not in
the aliases file.

Seriously, what "does not work" ? you should at least post excerpts
from the aliases file, showing the lines you want to match, and
copy&paste the commands you use and the output you receive. otherwise
no one will be able to anything but guessing.

                         Martin Paul | Systems Administrator
      Institute for Software Science |
Liechtensteinstrasse 22, A-1090 Wien | Tel: 01 4277 38803 | Fax: 01 4277 9388

 Sun, 03 Nov 2002 03:00:00 GMT   
 grep problems - strange
I agree with Martin.  Details are the only way "we" are going to be able
to help you.  Do this.  Post your script, blanking out part of your IP
address's and you may want to change host name, (not everyone who read
news groups are nice)  Post your alias.  We all know what a password
file look like but you can post part of it if you like.  Perhaps a
little section that you used for testing.  Do not post encrypted
passwords, simply put in a "X" where the pw would be.  Post the output
of your script when it works, or what it does in details.  Also post the
error message.  Just do a cut and paste.  Remeber not everyone on this
planet is nice "I LOVE YOU" virus should be a good example about that.
OK I shut up now.  Oh one last thing.  DO NOT reply to this message
with your new question make a new thread so that it will be on top.

In article <wqpU4.1237$>,
  "Brian Krahmer" <> wrote:

Sent via
Before you buy.

 Sun, 03 Nov 2002 03:00:00 GMT   
 grep problems - strange
I finally figured it out.  It turns out that the code I was using to add the
aliases was using unicode, so I was getting nulls in my file.  That was
causing grep not to match on the regex.


 Sun, 03 Nov 2002 03:00:00 GMT   
   [ 4 post ] 

Similar Threads

1. tail | grep | grep | grep

2. grep sTerm * | grep -v grep ???

3. Strange grep behavior

4. Strange grep behavior - fixed

5. strange grep error

6. Strange results with ps, grep, and awk

7. strange grep behavior

8. Strange ftp and telnet problems get stranger

9. strange floppy problem and strange outcome

10. Bug in grep or man grep

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software