![]() |
count lines and words
How can I display the no. of lines, words and characters for each file in current directory and in sub directory.
wc . * shows errornous result as there are some executable files in that directory. |
Sounds like homework.
You want your operation to skip non-text files - which means you'll need to put it in a script. What is the difference between files that have words and lines to count and those which do not? Work out how to test for this and write your script accordingly. The bash command "file" will probably help. You may also discover that all the valid files have some identifier in their name, like .txt |
Can you try this lipun4u,
Code:
wc `find . -type f | xargs ls -l | grep -v "^...x" | tr -s " " | cut -d " " -f 9` | more |
All times are GMT -5. The time now is 08:34 AM. |