-v var=val --assign var=val Assign the value val to the variable var, before execution of the program begins. Such variable values are available to the BEGIN block of an AWK program. [解决办法]
你的-f用错了
-f program-file --file program-file Read the AWK program source from the file program-file, instead of from the first command line argument. Multiple -f (or --file) options may be used.
这样就行了:
[root@ tmp]# cat urfile 1 2 3 a b c [root@ tmp]# awk '{ for (i = NF; i > 0; --i) print $i }' urfile 3 2 1 c b a