wc [-c | -m | -C ] [-l] [-w] [ file ... ]
-c | Count bytes. |
-m | Count characters. |
-C | Same as -m. |
-l | Count lines. |
-w | Count words delimited by white space characters or new line characters. Delimiting characters are Extended Unix Code (EUC) characters from any code set defined by iswspace() |
file | Name of file to word count. |
5 13 57 myfile.txt
5 = Lines
13 = Words
57 = Characters
13 = Words
57 = Characters
$ wc foo bar 40 149 947 foo 2294 16638 97724 bar 2334 16787 98671 total
- wc -l
print the line count - wc -c
print the byte count - wc -m
print the character count - wc -L
print the length of longest line - wc -w
print the word count
counts the number of users loggedps -e | wc -l
counts the number of processesls -l | grep ^d | wc -l # finds the number of subdirectories in the current directory.
wc -l /etc/passwd
tells you the number of lines (accounts) in the /etc/passwd file.wc -w readme.txt
counts the number of words in the file named readme.txt
No comments:
Post a Comment