grep replacement (first match only per file)

Guy Harris guy at gorodish.Sun.COM
Tue Jun 14 06:27:09 AEST 1988


> ? This works, and is indeed faster.  However, it shares one problem with
> ? all of the others: '*' expansion.  As an (uncomfortable) example,
> ? /usr/spool/news/talk/bizarre has over 2500 articles in it at our site,
> ? and the shell can't expand that properly (SunOS 3.4, if it matters).

"Fixed in 4.0", perhaps: from 4.0's "sys/param.h":

#define	NCARGS	0x100000	/* (absolute) max # characters in exec arglist */

(I don't know which versions of the shell can cope with 1MB argument lists, if
any.)

> Don't forget about xargs.

Assuming, of course, that your system has it; SunOS has it in releases 3.2 or
later (if you install the "System V Optional Software"; it's in "/usr/bin"),
but vanilla 4.xBSD doesn't, for example.  I would not be at all surprised to
hear that there is some public-domain reimplementation out there somewhere.



More information about the Comp.unix.wizards mailing list