COUNT=`cat random.txt | wc -l` ITEM=$RANDOM let "ITEM %= $COUNT" let "ITEM += 1" sed -n ${ITEM}p random.txt