awk 输出如下:
awk '{print $2}'
toto
titi
tata
我想在同一行显示 awk 的输出,使用空格作为分隔符而不是新行
awk [option] '{print $2}'
toto titi tata
这有可能吗?
最佳答案
来自手册页:
ORS The output record separator, by default a newline.
因此,
awk 'BEGIN { ORS=" " }; { print $2 }' file
关于linux - 是否可以在同一行中打印 awk 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24331687/