[vox-tech] Shell Scripting Question: Getting a directory name from a 'find' result

Richard Crawford vox-tech@lists.lugod.org
Mon, 23 Jun 2003 11:38:49 -0700 (PDT)


Mike Simons said:

> find . -name 'wwwboard.html' -print | sed 's/\/\([^\/]*\)$/ \1/' |
>   while read dir file; do
>     echo "file = $file, directory = $dir"
>   done

Thanks, that did the trick.


>   The more complex you make things the more you should look into doing
> this with perl.

My preference as well, but not really workable under the circumstances.

-- 
Sliante,
Richard S. Crawford

http://www.mossroot.com
AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford
MSN: underpope@hotmail.com

"It is only with the heart that we see rightly; what is essential is
invisible to the eye." --Antoine de Saint Exupéry