or "find . -type f -print" more details at http://www.softpanorama.org/Tools/Find/find_mini_tutorial.shtml
--- On Wed, 6/4/08, fooler mail <[EMAIL PROTECTED]> wrote: From: fooler mail <[EMAIL PROTECTED]> Subject: Re: [plug] Getting list of regular files (with whitespaces) using ls and AWK To: "Philippine Linux Users' Group (PLUG) Technical Discussion List" <plug@lists.linux.org.ph> Date: Wednesday, June 4, 2008, 9:08 PM On 6/4/08, Ludwig Isaac Lim <[EMAIL PROTECTED]> wrote: > Hi: > > I have a script that needs to get a list of regular files only (This means excluding > directories and symbolic links). Usually the line below works: > > ls -l | egrep '^-' | awk '{print $9;}' > > However the line above will fail for files having filename with whitespaces. > Any other ideas? yup...because $9 is the 9th field of a given record or line separated by default space character... the rest of it assigned to $10 and so on and so forth... the trick there is to play awk's string function ls -l | egrep '^-' | awk '{print substr($0, index($0,$9))}' fooler. _________________________________________________ Philippine Linux Users' Group (PLUG) Mailing List http://lists.linux.org.ph/mailman/listinfo/plug Searchable Archives: http://archives.free.net.ph
_________________________________________________ Philippine Linux Users' Group (PLUG) Mailing List http://lists.linux.org.ph/mailman/listinfo/plug Searchable Archives: http://archives.free.net.ph