#!/bin/ksh # randline.sh - not very efficient awk -v line_idx=$(( RANDOM % $(wc -l "$1" | awk '{print $1}') + 1 )) \ 'NR == line_idx {print;exit}' "$1"