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

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

RE: Grep problem


From: Gummadi, Latha C
Subject: RE: Grep problem
Date: Fri, 30 Sep 2005 10:04:46 -0700

Bob,

 

Firstly, I apologize for wrong way of presenting my problem and thank
you for your e-mail. Your response helped me figure out a few things.

 

1) yes | grep -m 3 y

  y

  y

  y

      a)This command works fine on my SuSE machine [LinuxSET Image
SLES9-1 Revision 7, SUSE LINUX Enterprise Server 9 (x86_64),Kernel
2.6.5-7.145lxset1-smp]. "grep"  

        version on this machine is 2.5.1

      b)This command does not work on my Red-Hat Linux machine [LinuxSET
Image 7.1.4 (Gold) Revision 19, Red Hat Linux release 7.1
(Seawolf)Kernel 2.4.9-45lxset34smp ]

        version on this machine is 2.4.2

      c)This command does not work on my Sun OS machine [SUNOS RELEASE:
5.8, Architecture: sun4u, Model: SUNW,Sun-Fire-280R]. Neither of  grep
-version,

        uname -a work on this machine.

 

2) Command I was trying to execute was `ls -l | grep -m 3 preview` in a
specific directory. I was trying this on my Sun machine and I kept
getting following error 

   message.

      grep: illegal option -- m

grep: illegal option -- 3

Usage: grep -hblcnsviw pattern file . . .

 

Appreciate your help and sorry once again.

 

Thanks

         

 

-----Original Message-----
From: Bob Proulx [mailto:address@hidden 
Sent: Thursday, September 29, 2005 9:22 PM
To: Gummadi, Latha C
Cc: address@hidden
Subject: Re: Grep problem

 

Gummadi, Latha C wrote:

> Why does grep -m option not work. I want to exit after I find n
matches

> in a n input file. How can I do this?

 

The grep -m option works fine.  Starting with such an accusational

tone is not a nice way to start a discussion.  Without further

information I can only guess that you are not using it correctly.

Here is an example of -m use from grep-2.5.1.

 

  yes | grep -m 3 y

  y

  y

  y

 

If this is not working for you then please furnish a small example

such as the above illustrating the exact commands that are not

functioning correctly for you.  Include the version of grep that you

are using and the system you are using it on.  The following commands

are useful for gethering this information.

 

  grep --version

  uname -a

 

Bob



reply via email to

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