echo boy:foo:cheese | awk -F":" '{print $1}'
Result: boy
echo boy:foo:cheese | awk -F":" '{print $2}'
Result: foo
i=1
echo boy:foo:cheese | awk -F":" '{print $($i)}'
Result: boy:foo:cheese
Also,
i=1
echo boy:foo:cheese | awk -F":" '{print $i}'
Result: boy:foo:cheese
I want to be able to print the ith item. The only possible reason this happens is that awk doesn't support variables for its print values? My end goal here is to loop through the string and get: boy foo cheese