Re: ls options: accept stdin, and list files except for...
Richard Dawe <[email protected]> Mon, 15 Sep 2003 20:32:19 +0100
| Newsgroups | gmane.comp.gnu.fileutils.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hello. Dan Heller wrote: > > On Sep 14, 8:15pm, Richard Dawe wrote: > > find . ! -type d ! -name '*.html' | xargs ls [OPTIONS] > > > > (Find all files that are not directories and not called '*.html'.) > > There is one major issue here, and one mnor one. The major problem is > that the output for one command may be too long to be used as the > command for whatever xargs launches. Um, that's the problem that xargs is designed to avoid. It knows the maximum allowed command-line length. If the command-line would be too long for whatever command xargs is running, then it will split it. See the man page for xargs. [snip] > I can't use xargs, backticks, or even a shell script that saves the > list and launches things separately because of the inherent problem > that the command can't be executed if the arg list is too long. You can use xargs. > IMHO, the simplest solution to this, and the most elegant, albeit not > one that would win an obfuscated coding contest, is to simply enhance > command-line utils to read the list of filename arguments on stdin. [snip] There's no need. You can use xargs. Believe me, I've used xargs with a command-line consisting of over 7000 absolute paths and it worked fine. Regards, -- Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]