Looping over input fields as array

前端 未结 4 1141
夕颜
夕颜 2021-01-03 19:04

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
         


        
4条回答
提交回复
热议问题