sperry.ace Posted January 12, 2009 Share Posted January 12, 2009 Hello, i have some .c files in different folder under /code/ and i want to find the number of lines of code ( LOC ) of all those files. i tired doing wc -l | find *.c /code/ but its not giving the correct out . ie., number of lines all in total. Thanks ~Ace Link to comment https://forums.phpfreaks.com/topic/140493-shell-commad-sending-output-of-find-command-to-wc-l/ Share on other sites More sharing options...
trq Posted January 12, 2009 Share Posted January 12, 2009 cat /code/*.c | wc -l Link to comment https://forums.phpfreaks.com/topic/140493-shell-commad-sending-output-of-find-command-to-wc-l/#findComment-735194 Share on other sites More sharing options...
sperry.ace Posted January 12, 2009 Author Share Posted January 12, 2009 This is not wokring - this will pring the files in same folder and not recursively. please note that there are severrel files like /code/abc.c /code/A/test.c /code/B/main.c /code/c/d/inc.c ~Ace Link to comment https://forums.phpfreaks.com/topic/140493-shell-commad-sending-output-of-find-command-to-wc-l/#findComment-735254 Share on other sites More sharing options...
trq Posted January 12, 2009 Share Posted January 12, 2009 find /code -name '*.c' -exec cat {} \; | wc -l Link to comment https://forums.phpfreaks.com/topic/140493-shell-commad-sending-output-of-find-command-to-wc-l/#findComment-735278 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.