On Wed, Sep 13, 2000 at 01:16:01PM -0700, Steve Dixon wrote: | I wonder if there is a restraint on the number of files in a directory | fgrep will work on - is it something that can be increased? See below: | | eb@dpnz src]$ cd ../src6 | [deb@dpnz src6]$ fgrep -n DNADD * | more | AEADD:63::: CHAINR TO DNADD if account is 'D' | AEADD:116::: DNADD | AEADD:2747:::: to pass fields to DNADD | AEADD:2758: MOVE 'DNADD' TO WS-CHAINR-PROGRAM | AEADD:2762::: 5/17/00 added to clear shead from DNADD | | [deb@dpnz src6]$ cd ../src | [deb@dpnz src]$ fgrep -n DNADD * | more | fgrep: invalid option -- - | Usage: fgrep [OPTION]... PATTERN [FILE]... | Try `fgrep --help' for more information. | | It worked when I was in a directory with very few files, but gave me an | error in a directory that had many more files. This is on 6.2 w/grep | 2.4 that came installed stock. More likely the GNU fgrep's option parsing is busted. I would guess you have a file named "-" and for some reason fgrep is still looking for options after the PATTERN argument (which of course it shouldn't). [Tests this...] Hmm, ok behaviour for simple test #1: solaris% /bin/fgrep -n foo bah - blah fgrep: can't open bah fgrep: can't open - fgrep: can't open blah linux% /bin/fgrep -n foo bah - blah fgrep: bah: No such file or directory fgrep: blah: No such file or directory In that last one there's a pause you can't see while it tries to treat "-" as stdin, which solaris fgrep doesn't. Test #2 goes: solaris% /bin/fgrep -n foo bah --- blah fgrep: can't open bah fgrep: can't open --- fgrep: can't open blah linux% /bin/fgrep -n foo bah --- blah /bin/fgrep: unrecognized option `---' Usage: fgrep [OPTION]... PATTERN [FILE]... Try `fgrep --help' for more information. which is what you're seeing. So yes, GNU fgrep's option parsing is TOTALLY BROKEN. Cretins. It's not like it's hard to get that right you know... Welcome to the world of apps-with-bugs. Find the author of fgrep and flame them. Now, to help you out, there's a common trick you can use in these situations, which is actually applicable in any situation where you have the potential of having a filename misrecognised as an option. Say this: fgrep -n BLAH ./* This causes all names to start with the character ".", which doesn't look like an option. The classic example is "how do I remove a file whose name starts with '-'?" A generally useful trick, though not one you should have needed in this case :-( Cheers, -- Cameron Simpson, DoD#743 [EMAIL PROTECTED] http://www.zip.com.au/~cs/ GNU Emacs is a LISP operating system disguised as a word processor. - Doug Mohney, in comp.arch