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.
如果我在一个文件中有两行,如下所示:
1 222 333 4 555 666
有没有办法一次访问所有这些:
$1 = 1, $2 = 222, $3 = 333, $4 = 444, $5 = 555, $6 = 666
有什么想法吗?
将您的 RS 更改为其中不存在的唯一 8 位 ascii 字符值,例如
awk 'BEGIN{RS="\xFF"}{print $1, $2, $3, $4, $5, $6}' file
这应该适用于 all awk,设置RS为空。
awk
RS
awk '{print $5}' RS="" file 555