du or wc and file names with spaces
Hi,
This issue has been giving me much trouble. The current directory points to the root of a CD with directories containing spaces in their names. How can you count the total number of lines in all *.c-files (recursively) using wc? An equivalent problem: How to determine the total disk space occupied by those files using du? Eventually I could solve it somehow using grep, but there has to be a solution using wc and du (adjusting $IFS?). Your suggestions are welcome, |
Ummm im not sure if i understand you correctly but
wc *.c du -c *.c |
Diskspace: not using du, though...
Code:
find -iname "*.[ch]" -exec ls -l {} \; | awk '{bytes += $5 ; files += 1 }; END { print "Bytes total is", bytes ," in ", files ," files"} ' Code:
find -iname "*.[ch]" -exec wc -l {} \; | awk '{lines += $1 ; files += 1 }; END { print "Lines total is", lines ," in ", files ," files"} ' Cheers, Tink |
All times are GMT -5. The time now is 08:51 PM. |