Computing.Net > Forums > Unix > Word Count

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Word Count

Reply to Message Icon

Name: Gburg
Date: October 31, 2003 at 15:38:30 Pacific
OS: win xp
CPU/Ram: ???
Comment:

How would I execute a loop to count each word in a file individually, without using the wc command.



Sponsored Link
Ads by Google

Response Number 1
Name: Frank
Date: November 3, 2003 at 02:29:10 Pacific
Reply:

you can use the script below if your words are space seperated.

#!/bin/ksh
typeset -i I=0
{ while read line
do
for wort in `echo $line`
do
I=$I+1
done
done } < $1
echo $I

No Risk no fun Frank


0
Reply to Message Icon

Related Posts

See More


shell script One More Question



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Word Count

Word count in unix www.computing.net/answers/unix/word-count-in-unix/7143.html

script with word count compare www.computing.net/answers/unix/script-with-word-count-compare/3700.html

word count www.computing.net/answers/unix/word-count/7656.html