Jerry Keene wrote:
> 
> I've tried deleting, for example, all *nav_blueprnt010* files using the
> rm and find utilities and backquotes.  All these files have
> embedded spaces.
> 
> Using the form
>         rm `find /home/httpd/html -name *nav_blueprnt010*`
> 
> results in failure because the backquoted output breaks the files
> into separate parts at every space.  Since the resulting filenames
> are nonsensical, the process fails with a "file not found" type error.
> 
> Using the form
>         rm "`find/home/httpd/html -name *nav_blueprnt010*`"
> 
> generates a sensible backquoted listing with full filenames on each
> line of output.   However the output concatenates all the filenames
> into one excessively long super file.  The process then fails with a
> msg that the file is too long.
> 
> Am I tantalizingly close here or totally on the wrong track?

Close but it may be a lot easier to break the job into pieces. Redirect
the output of the find command to a file (foundfiles.dat) and run this sed
command on it:

   cat foundfiles.dat | sed -e "s/^/rm \"/" -e "s/$/\"/" > delfiles.sh

That will put an rm command and a quoted filename on each line of the
output file. Then just run the result as a shell script to delete the
files:

   bash delfiles.sh

Tony
-- 
 Anthony E. Greene <[EMAIL PROTECTED]>
 Homepage & PGP Key <http://www.pobox.com/~agreene/>
 Penguins thrive in harsh climates. Windows break under pressure.


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to