[CDBUG-talk] OT: script help

Patrick Muldoon doon at inoc.net
Wed May 12 09:17:45 EDT 2010


Try using the exec option to find as opposed to printing and pipe. While I do have sed on my phone :)  typing on the small keybaord is a bit rough. I pretty sure I have an example of this on my laptop...

Patrick



--Patrick Muldoon
Network/Software Engineer
INOC

Typed with only my thumbs on a Palm Pre...
On May 12, 2010 9:07, Jonathan Franks <jonathan.franks at gmail.com> wrote: 

Hey guys,

I'm writing a little sed script to append a few lines to a file and I've run in to a problem. The script looks like this:

#! /bin/sh

find ./ -type f -name 'FileToFind' -print | while read i

do
 sed -i[bak] '$a\
stuff to append\
more stuff to append' $i
done

It works fine in testing, however in practice the absolute path to the file(s) contains a directory with a space in the name (Thanks, Apple...). 

Anyone know of a way to have the path sent to sed in quotes? 

-Jonathan


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nycbug.org/pipermail/cdbug-talk/attachments/20100512/934d0aa0/attachment.html>


More information about the CDBUG-talk mailing list