I have a script which needs to read from a file, that file is always made up like:
bench toast pepperoni bacon
fruit berry banana
doom happy winter mountain kiwi
The code below, gets me from the third column to the end of the document, so the result is:
cat file | awk -v n=3 '{ for (i=n; i<=NF; i++) printf "%s%s", $i, (i<NF ? OFS : ORS)}'
pepperoni bacon
banana
mountain kiwi
My question is, how can I implement a counting variable for each element so the result shows as:
(1) pepperoni bacon
(2) banana
(3) mountain kiwi
so on...