Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Jan 2002 23:25:17 +0100 (CET)
From:      Oliver Fromme <olli@secnetix.de>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Overriding ARG_MAX
Message-ID:  <200201052225.g05MPHf59931@lurza.secnetix.de>
In-Reply-To: <20020105211124.GA76316@ussenterprise.ufp.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Leo Bicknell <bicknell@ufp.org> wrote:
 > In a message written on Sat, Jan 05, 2002 at 09:48:40PM +0100, Oliver Fromme wro
 > te:
 > > ls | grep '\.out$' | wc -l
 > 
 > One process shorter: find -name "*.out" -maxdepth 0 | wc -l

OK, but I tried to be as portable as possible, while
-maxdepth is not portable (e.g. Solaris doesn't have it).

 > > ls | grep '\.data$' | xargs grep something
 > 
 > Two problems, first use find, second use /dev/null:
 > find -name "*.data" -maxdepth 0 | xargs grep something /dev/null 

But that one will give you different result than the
original command.

I'm well aware of the /dev/null issue, but this wasn't
the question in the first place.

 > > ls | grep '\.foo$' | xargs cat | grep somethingA
 > 
 > A completely unnecessary use of cat.

Yep, already in the original command, so I kept it.
(I had already typed a comment about "useless use of cat"
in my mail, but deleted it again, thinking that it was
intentional to achieve the same effect as grep -h.)

 > You can't do that with ls | grep, since only the filenames make it
 > to grep.

You could do it with ls -l | awk, though.  ;-)

Regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"All that we see or seem is just a dream within a dream" (E. A. Poe)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201052225.g05MPHf59931>