printing fields in reverse order

command/script(apart from awk) to print the fields in reverse order
that is last field has to come first and so on and first field has to go last

           Input 
                     store-id date sale
                      .............
                      .............
            output
                      sale date store-id
                       ............
                       ............
 

thanks

what u have tried so far?

Try:

awk '{for (i=NF;i>0;i--){printf $i" "};printf "\n"}' file
cat INPUTFILE
command/script(apart from awk) to print the fields in reverse order
that is last field has to come first and so on and first field has to go last

% sed -n ':a h
s/.* \(.*\)/\1/p
x
s/\(.*\) .*/\1/
h
ta
s/$/\n/p' INPUTFILE | tr '\n' ' ' | sed 's/  /\n/'g
order reverse in fields the print to awk) from command/script(apart
last go to has field first and on so and first come to has field last is that

:wink: