[wplug] Handling spaces in file names

Greg Akins gakins at insomnia-consulting.org
Fri Nov 19 20:07:28 EST 2004


On Fri, 2004-11-19 at 14:24, J Aaron Farr wrote:
> 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")

Are you expecting to get a total lines for an entire repository?  Or a list of files with word counts for each file?

If the second, can you use $find . -name '*.java' | xargs wc


More information about the wplug mailing list