>>>>> "Mathew" == Mathew Hennessy <[EMAIL PROTECTED]> writes:

Mathew> Fair enough, though for truly oneoff stuff find |while read is 
still my
Mathew> friend...

Mathew> find ./ -type f -name *.bak -mtime +30 |while read f; do echo 
"removing
Mathew> [$f]"; rm -f $f; done

Mathew> (on solaris)
Mathew> ps -ef|while read owner pid ppid other; do if test $owner == 
"real";
Mathew> then echo "$owner: [$pid]"; fi; done

Randal> As long as you don't mind someone ruining your day when you have
Randal> a filename or a directory name with an embedded newline, that's
Randal> fine.  My all-perl solutions never have that problem.

Randal,
        Just out of curiosity ( and to learn more ), as you say, suppose a 
filename has an embedded newline in it. Referring to Mathew's solution, 
can't we somehow read that as a single filename and operate on it? 
Specifically, does the shell ( read builtin etc. ) provide any way to do 
it? 

Thanks,
Atul

Reply via email to