The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



Thread: Random
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 05-24-2007
anbu23 anbu23 is offline
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
Reply With Quote