Re: [SLUG] Need help with a sed script

From: Eben King (eben1@tampabay.rr.com)
Date: Sat Aug 02 2003 - 14:26:36 EDT


On Sat, 2 Aug 2003, Timothy L. Jones wrote:

> > Use `find . -name '*.php'` instead of *.php,
>
> A common problem with backquotes is that sometimes the commands return too
> much data, and causes the shell to say 'too many arguments', and that kills
> the whole loop.
>
> Piping a stream into a 'while read' loop, as in my previous post, does not
> suffer from this size limitation, because there is no attempt to process all
> the data in one shot.
>
> There is a downsize, however. My method exposes to data to shell expansion
> one additional time, and that spells disaster if the filenames contain
> spaces, parenthesis or other shell metacharacters.

If you have the GNU find/xargs, you can use

find ... -print0 | xargs -0 ...

to avoid this. This separates filenames with '\0', one of two illegal
ext2 filename characters, I believe (the other being '/').

-- 
-eben    ebQenW1@EtaRmpTabYayU.rIr.OcoPm    home.tampabay.rr.com/hactar
CAPRICORN:  The stars say you're an exciting and wonderful person...
but you know they're lying.  If I were you, I'd lock my doors and
windows and never never never never leave my house again.  -- Weird Al

----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 15:57:00 EDT