in reply to Re: Myth busted: Shell isn't always faster than Perl
in thread Myth busted: Shell isn't always faster than Perl

Yeah, that brings the shell closer in speed, BUT it starts complaining AND skipping filenames with spaces in them, I believe that is why the original contruct was the way it was.

I'm not really a human, but I play one on earth. flash japh
  • Comment on Re^2: Myth busted: Shell isn't always faster than Perl

Replies are listed 'Best First'.
Re^3: Myth busted: Shell isn't always faster than Perl
by jdporter (Paladin) on Dec 30, 2005 at 20:36 UTC
    it starts complaining AND skipping filenames with spaces in them

    ...And that is precisely why find has the -print0 switch and xargs has the -0 (or --null) switch.

    find . -type f -print0 | xargs -0 rm
    We're building the house of the future together.
      This leaves the problem of a very big list, in which case the shell (I presume) would refuse to start the xargs side.

      Flavio
      perl -ple'$_=reverse' <<<ti.xittelop@oivalf

      Don't fool yourself.
        You're wrong.

        xargs is smart enough to deal with that. If the argument list would exceed certain limits (may depend on the system and the build to xargs, for some versions of xargs, limits can be set as parameters), as many copies of the program will be fired up as necessary. Limits exist on the number of arguments, and the total length of the arguments.

        Perl --((8:>*