home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / question / 10925 < prev    next >
Encoding:
Internet Message Format  |  1992-09-10  |  1.1 KB

  1. Path: sparky!uunet!mcsun!uknet!root44!gwc
  2. From: gwc@root.co.uk (Geoff Clare)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: Question: which is faster 'find -exec' or 'find | xargs' ??
  5. Message-ID: <BuDG01.LIE@root.co.uk>
  6. Date: 10 Sep 92 16:47:59 GMT
  7. References: <1992Sep4.041033.23158@news.acns.nwu.edu> <188lknINNotr@early-bird.think.com>
  8. Organization: UniSoft Ltd., London, England
  9. Lines: 22
  10.  
  11. barmar@think.com (Barry Margolin) writes:
  12.  
  13. |The -exec version executes a separate ls command for each file that is
  14. |found.  The xargs version accumulates a bunch of arguments and then
  15. |executes one ls command with all of them.  The difference is all the time
  16. |spent starting up new shell and ls processes.  It's the difference between:
  17. |
  18. |    sh -c "ls file1"
  19. |    sh -c "ls file2"
  20. |    sh -c "ls file3"
  21. |    sh -c "ls file4"
  22. |    sh -c "ls file5"
  23. |
  24. |and
  25. |
  26. |    sh -c "ls file1 file2 file3 file4 file5"
  27.  
  28. Almost right.  In fact find and xargs both execute the commands directly,
  29. they don't start a shell.
  30. -- 
  31. Geoff Clare <gwc@root.co.uk>  (USA UUCP-only mailers: ...!uunet!root.co.uk!gwc)
  32. UniSoft Limited, London, England.   Tel: +44 71 729 3773   Fax: +44 71 729 3273
  33.