

3·
7 days agoFor the simpler case of threshold match and larger, with the list already ordered, you could use sed:
echo $list | sed -n '/^150$/,$p'
The edge case is tricky because “equal or lower” can’t be expressed with regex cleanly, so even an awk solution would look kinda convoluted, so I personally prefer a for loop for readability’s sake:
for i in $list; do
if [ "$i" -le "$threshold" ]; then
head="$i"
else
tail="$tail\n$i"
fi
done
printf '%b\n' "$head$tail"
The quoting oversight was due to me testing the first one only on zsh, which quotes differently.
The second was tested on Busybox ash and dash against the input in the example. It does assign a number just smaller or equal to threshold because head is overwritten on each iteration until it lands on the last value that was less than or equal to the threshold.