Word Count

Score
0
Vote Up
Gburg October 31, 2003 at 15:38:30 Pacific
Specs: win xp, ???

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


Reply ↓  Report •


#1
Vote Down
Score
0
Vote Up
November 3, 2003 at 02:29:10 Pacific

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


Reply ↓  Report •
Reply to Message Icon Start New Discussion
Related Posts

« shell script One More Question »

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

Ask the Community!
Describe your Problem
Example: Hard Drive Not Detected on My PC