💾 Archived View for thrig.me › blog › 2023 › 10 › 30 › randline.sh captured on 2023-11-04 at 12:27:29.
-=-=-=-=-=-=-
#!/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"