home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!root44!gwc
- From: gwc@root.co.uk (Geoff Clare)
- Newsgroups: comp.unix.questions
- Subject: Re: Question: which is faster 'find -exec' or 'find | xargs' ??
- Message-ID: <BuDG01.LIE@root.co.uk>
- Date: 10 Sep 92 16:47:59 GMT
- References: <1992Sep4.041033.23158@news.acns.nwu.edu> <188lknINNotr@early-bird.think.com>
- Organization: UniSoft Ltd., London, England
- Lines: 22
-
- barmar@think.com (Barry Margolin) writes:
-
- |The -exec version executes a separate ls command for each file that is
- |found. The xargs version accumulates a bunch of arguments and then
- |executes one ls command with all of them. The difference is all the time
- |spent starting up new shell and ls processes. It's the difference between:
- |
- | sh -c "ls file1"
- | sh -c "ls file2"
- | sh -c "ls file3"
- | sh -c "ls file4"
- | sh -c "ls file5"
- |
- |and
- |
- | sh -c "ls file1 file2 file3 file4 file5"
-
- Almost right. In fact find and xargs both execute the commands directly,
- they don't start a shell.
- --
- Geoff Clare <gwc@root.co.uk> (USA UUCP-only mailers: ...!uunet!root.co.uk!gwc)
- UniSoft Limited, London, England. Tel: +44 71 729 3773 Fax: +44 71 729 3273
-