Re: [SLUG] Need help with a sed script

From: Timothy L. Jones (tim@timjones.com)
Date: Sat Aug 02 2003 - 13:55:24 EDT


> 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. (Of course, if you have
this situation, that it a whole other problem. Fortunately, in my
experience, the files like this come from Windows users (Word documents, MP3
files originally ripped on Windows PCs, etc). Spaces in filenames is yet
another egregious crime against computing. :-)

tlj

-----------------------------------------------------------------------
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:56:54 EDT