decimate() {
# Desc: Randomly remove 10% of stdin lines
- # Depends: GNU Coreutils 8.32 (shuf)
+ # Depends: Bash 5.1.16; GNU Coreutils 8.32 (shuf, nl, head, sort, cut)
# Version: 0.0.1
# Read lines
lc="${#lines[@]}";
lk="$((lc * 900 / 1000))";
+ # Output
printf "%s\n" "${lines[@]}" | \
nl -w1 -s' ' | \
shuf | \