Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个file包含:
file
x1 x2 x3 x4 x5 x6 x7 x8 x9
我想要的:
x1 x2 x3 . .
您如何使用 awk 或其他方式做到这一点?
与awk:
awk
$ awk '1' RS=' ' ORS='\n' file x1 x2 x3 x4 x5 x6 x7 x8 x9
但是我个人会这样做:
$ xargs -n1 < file x1 x2 x3 x4 x5 x6 x7 x8 x9
或者:
$ grep -o '\S*' file x1 x2 x3 x4 x5 x6 x7 x8 x9