Is it possible to do something like this:
$ cat foo.txt 1 2 3 4 foo bar baz hello world $ awk '{ for(i in $){ print $[i]; } }' foo.txt 1 2 3 4 foo bar baz hello world
I know you could do this:
$ awk '{ split($0,array," "); for(i in array){ print array[i]; } }' foo.txt 2 3 4 1 bar baz foo world hello
But then the result is not in order.
Found out myself:
$ awk '{ for(i = 1; i <= NF; i++) { print $i; } }' foo.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With