
05-24-2007
|
|
Registered User
|
|
Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
|
|
Quote:
|
Originally Posted by keyvan
what can be used instead of sed, as i dont know anything about sed and rather learn shell scripting first and then look at sed, also just so i can understand this better, the random word file, needs to one word per line and numbered for this to work??
You are a star
Keyvan
|
Code:
no=$(( RANDOM % 21 + 1 ))
while read str
do
(( no = no - 1 ))
if [[ $no -eq 0 ]]; then
word=$str
break
fi
done < words_list_file
letters=$(echo $word | wc -c)
letters=$(( $letters - 1 ))
template="$(echo $word | tr '[a-z A-Z 0-9]' '.')"
remaining=$letters
|