value=$(some command)
for all in `echo $value`
do
awk checks each value (all) to see if it is a odd number. if so, prints the value
done
sounds easy enough but i've been unable to find anything on google.
value=$(some command)
for all in `echo $value`
do
awk checks each value (all) to see if it is a odd number. if so, prints the value
done
sounds easy enough but i've been unable to find anything on google.
awk can use modulus 2 and if result is 0 it's even:
$ echo "12" | awk "$0%2"
$ echo "13" | awk "$0%2"
13
But, do you really need to use awk this can be achieved from within the shell:
for all in 2 3 4 5 6
do
[ $((all%2)) -gt 0 ] && echo $all
done
In recent shells, you could even simplify that to
for all in 2 3 4 5 6; do ((all%2)) && echo $all; done