You can use wc -m or –chars option to print only the character counts. By default, wc command prints newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified.
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
## create a file with 100 lines > myfile; i=1; while [ $i -le 100 ]; \ do echo "$i" >> myfile; ((i++)); done ## default ## newline words byte filename wc myfile ## returns 100 100 292 myfile ## wc -m or --chars option ## charecter filename wc -m myfile ## returns 292 myfile rm myfile |