Date: Wed, 5 Aug 2009 08:32:47 -0800 From: Mel Flynn <mel.flynn+fbsd.questions@mailing.thruhere.net> To: freebsd-questions@freebsd.org Subject: Re: find question Message-ID: <200908050832.47299.mel.flynn%2Bfbsd.questions@mailing.thruhere.net> In-Reply-To: <4ad871310908050833k54f3f3a7v679737941e3fa235@mail.gmail.com> References: <42D44C8E-1E22-426C-A9AA-0FBF2A52188A@socket.net> <200908050712.39131.mel.flynn%2Bfbsd.questions@mailing.thruhere.net> <4ad871310908050833k54f3f3a7v679737941e3fa235@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 05 August 2009 07:33:42 Glen Barber wrote: > On Wed, Aug 5, 2009 at 11:12 AM, Mel > > Flynn<mel.flynn+fbsd.questions@mailing.thruhere.net> wrote: > > On Wednesday 05 August 2009 07:00:40 Glen Barber wrote: > >> On Wed, Aug 5, 2009 at 3:36 AM, Matthew > >> > >> Seaman<m.seaman@infracaninophile.co.uk> wrote: > >> > Try this as: > >> > > >> > for line in $( cat $FILELIST ) ; do > >> > echo $line > >> > find $line -type f >> $TMPFILE > >> > done > >> > > >> > *assuming that none of the directory names in $FILELIST contain > >> > spaces* > >> > >> for line in $( cat $FILELIST | sed -e 's/\ //g') ; do > >> echo $line > >> find $line -type f >> $TMPFILE > >> done > >> > >> This *should* fix any directories containing spaces. > > > > And also make find look in non-existing directories. > > True, but any script that needs to find directories containing spaces > is going to be hack-ish. > > for line in $( cat $FILELIST | sed -e 's/\ /SPACE/g') ; do > echo $line | sed -e 's/SPACE/\ /g' > find $line -type f >> $TMPFILE > done Not really, simply quote your arguments so that IFS is not in the picture. The OP had the right the idea by using a pipe+while read. % echo My Documents|while read LINE; do find "${LINE}" -type f; done My Documents/foo -- Mel
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908050832.47299.mel.flynn%2Bfbsd.questions>