[wplug] Handling spaces in file names

Poyner, Brandon bpoyner at ccac.edu
Fri Nov 19 14:52:43 EST 2004


I would just change the order around some and have find exec wc.

find . -name "*.java" -type f -exec wc {} \;

Brandon Poyner
Network Engineer II
CCAC - College Office
412-237-3086
 
-----Original Message-----
From: J Aaron Farr [mailto:farra at apache.org] 
Sent: Friday, November 19, 2004 2:24 PM
To: wplug at wplug.org
Subject: [wplug] Handling spaces in file names

Hello all.

Simple UNIX scripting question:

I want to do this:

  wc `find . -name *.java`

on a large repository to get total number of lines of code.  But some of
the files or directories have spaces which 'wc' doesn't like.  So, do I
have to write up a script to do this or is there some way I can get
'find'
to print the file names with the spaces escaped?  (ie- "My\ Documents"
instead of "My Documents")

Thanks for any suggestions.
jaaron
_______________________________________________
wplug mailing list
wplug at wplug.org
http://www.wplug.org/mailman/listinfo/wplug




More information about the wplug mailing list