Re: xargs PF or BPF

2006-02-14 Thread Michael Schmidt
Matthias Kilian wrote: And watch out for silly file names containing whitespace. BTW: if this is a contest on creative use of find(1) and other standard tools: $ find . -type f | sed '[EMAIL PROTECTED]@grep -l -- foo @' | sh Yes, this isn't robust against whitespace, either PLUS it's

Re: xargs PF or BPF

2006-02-14 Thread Otto Moerbeek
On Tue, 14 Feb 2006, Michael Schmidt wrote: Matthias Kilian wrote: And watch out for silly file names containing whitespace. BTW: if this is a contest on creative use of find(1) and other standard tools: $ find . -type f | sed '[EMAIL PROTECTED]@grep -l -- foo @' | sh Yes,

Re: xargs PF or BPF

2006-02-14 Thread Ray Lai
On Tue, Feb 14, 2006 at 11:39:45AM +0100, Otto Moerbeek wrote: On Tue, 14 Feb 2006, Michael Schmidt wrote: Matthias Kilian wrote: And watch out for silly file names containing whitespace. BTW: if this is a contest on creative use of find(1) and other standard tools: $

Re: xargs PF or BPF

2006-02-14 Thread Otto Moerbeek
On Tue, 14 Feb 2006, Ray Lai wrote: On Tue, Feb 14, 2006 at 11:39:45AM +0100, Otto Moerbeek wrote: On Tue, 14 Feb 2006, Michael Schmidt wrote: Matthias Kilian wrote: And watch out for silly file names containing whitespace. BTW: if this is a contest on creative use of

Re: xargs PF or BPF

2006-02-13 Thread Tim Donahue
On Monday 13 February 2006 17:13, Stuart Henderson wrote: On 2006/02/13 16:53, Jason Crawford wrote: On 2/13/06, Matthias Kilian [EMAIL PROTECTED] wrote: On Mon, Feb 13, 2006 at 02:03:27PM -0700, Diana Eichert wrote: find /usr/src -name *.[c|h] -exec grep 'bpf.h' /dev/null {} \; it's

Re: xargs PF or BPF

2006-02-13 Thread Martin Schröder
On 2006-02-13 18:10:53 -0500, Tim Donahue wrote: As done by xargs? grep foo 1 grep foo 2 grep foo 3 quote src=xargs(1) Any arguments specified on the command line are given to the utility upon each invocation, followed by some number of the arguments read from stan- dard

Re: xargs PF or BPF

2006-02-13 Thread Damien Miller
On Tue, 14 Feb 2006, noob lenoobie wrote: On Mon, 13 Feb 2006, Matthias Kilian wrote: (b) pipeing to xargs(1) may be faster. Why so many people is using xargs ? I mean for instance why bother use xargs AND a pipe to do somthing like this : find ./ -type f -print | xargs -i rm -f

Re: xargs PF or BPF

2006-02-13 Thread Andrew Pinski
On Feb 13, 2006, at 9:24 PM, Damien Miller wrote: Because that will fail when there are too many arguments, and will probably break on filenames with spaces (use xargs -0 for these). Why not use -exec in find? find . -type f -name ttt -exec rm {}\; -- Pinski

Re: xargs PF or BPF

2006-02-13 Thread Ted Unangst
On 2/13/06, Damien Miller [EMAIL PROTECTED] wrote: Why so many people is using xargs ? I mean for instance why bother use xargs AND a pipe to do somthing like this : find ./ -type f -print | xargs -i rm -f Instead of rm -f $(find ./ -type f -print) Because that will fail when

Re: xargs PF or BPF

2006-02-13 Thread Andrew Pinski
On Feb 13, 2006, at 9:53 PM, Jason Crawford wrote: On 2/13/06, Andrew Pinski [EMAIL PROTECTED] wrote: On Feb 13, 2006, at 9:24 PM, Damien Miller wrote: Because that will fail when there are too many arguments, and will probably break on filenames with spaces (use xargs -0 for these). Why

Re: xargs PF or BPF

2006-02-13 Thread Jason Crawford
On 2/13/06, Andrew Pinski [EMAIL PROTECTED] wrote: On Feb 13, 2006, at 9:24 PM, Damien Miller wrote: Because that will fail when there are too many arguments, and will probably break on filenames with spaces (use xargs -0 for these). Why not use -exec in find? find . -type f -name ttt

Re: xargs PF or BPF

2006-02-13 Thread Jason Crawford
On 2/13/06, Andrew Pinski [EMAIL PROTECTED] wrote: On Feb 13, 2006, at 9:53 PM, Jason Crawford wrote: On 2/13/06, Andrew Pinski [EMAIL PROTECTED] wrote: On Feb 13, 2006, at 9:24 PM, Damien Miller wrote: Because that will fail when there are too many arguments, and will probably break on

Re: xargs PF or BPF

2006-02-13 Thread Damien Miller
On Mon, 13 Feb 2006, Andrew Pinski wrote: On Feb 13, 2006, at 9:24 PM, Damien Miller wrote: Because that will fail when there are too many arguments, and will probably break on filenames with spaces (use xargs -0 for these). Why not use -exec in find? find . -type f -name ttt -exec

Re: xargs PF or BPF

2006-02-13 Thread Andrew Pinski
On Feb 13, 2006, at 10:00 PM, Jason Crawford wrote: Time to write your own program in C instead if the time to invoke rm is taking too much time. No point, xargs does what I need it to do, and is much more efficient than having find execute rm itself. The fewer times you call execve(2) the

Re: xargs PF or BPF

2006-02-13 Thread Damien Miller
On Mon, 13 Feb 2006, Andrew Pinski wrote: Time to write your own program in C instead if the time to invoke rm is taking too much time. rm *is* a small program written in C. You need to consider how the tools actually invoke it - think about it for a while. -d

Re: xargs PF or BPF

2006-02-13 Thread Matthias Kilian
On Mon, Feb 13, 2006 at 06:32:53PM -0800, Ted Unangst wrote: find ./ -type f -print | xargs -i rm -f Instead of rm -f $(find ./ -type f -print) Because that will fail when there are too many arguments, and will probably break on filenames with spaces (use xargs -0 for these).