APM: Modify in place and Argument list too long
Wayne Walker
wwalker at broadq.com
Mon Mar 17 13:24:26 CST 2003
On Mon, Mar 17, 2003 at 02:17:26PM -0500, Mike Stok wrote:
> The only thing I would add is that you can use find and xargs together on
> files whose names include blanks, tabs, newlines etc like this
>
> [mike at ratdog tmp]$ touch foo.html
> [mike at ratdog tmp]$ touch 'bar baz.html'
> [mike at ratdog tmp]$ ls -l
> total 0
> -rw-rw-r-- 1 mike mike 0 Mar 17 14:15 bar baz.html
> -rw-rw-r-- 1 mike mike 0 Mar 17 14:15 foo.html
> [mike at ratdog tmp]$ find . -name '*.html' | xargs ls
> ls: ./bar: No such file or directory
> ls: baz.html: No such file or directory
> ./foo.html
> [mike at ratdog tmp]$ find . -name '*.html' -print0 | xargs -0 ls
> ./bar baz.html ./foo.html
I forgot to point that problem out (spaces and tabs in the names), but
had never seen the -0 and -print0 options. Thanks!
I always fixed the the hard way:
find . -name '*.html' -print | sed -e 's/^/"/' -e 's/$/"/' | xargs .....
You'll need to do it the hard way on something like HP-UX, Solaris, and
other inferior OS's :)
>
> Mike
>
> --
> mike at stok.co.uk | The "`Stok' disclaimers" apply.
> http://www.stok.co.uk/~mike/ | GPG PGP Key 1024D/059913DA
> mike at exegenix.com | Fingerprint 0570 71CD 6790 7C28 3D60
> http://www.exegenix.com/ | 75D2 9EC4 C1C0 0599 13DA
--
Wayne Walker
www.broadq.com :) Bringing digital video and audio to the living room
More information about the Austin
mailing list