文件内容:(基于主题 -> 1)
"Shimshon A",
"(blank)",
"November 24, 2012",
"13,481",
"jonathan t",
"Laguna Niguel, CA",
"November 24, 2012",
"13,480",
"scott b",
"Sussex, NJ",
"November 24, 2012",
"13,479",
如何改进命令?:
gawk --posix 'ORS="";{sub(/,[0-9]{3}/, "&&\n"); print }' file
结果:
$ gawk --posix 'ORS="";{sub(/,[0-9]{3}/, "&&\n"); print }' file
"Shimshon A","(blank)","November 24, 2012","13,481,481
","jonathan t","Laguna Niguel, CA","November 24, 2012","13,480,480
","scott b","Sussex, NJ","November 24, 2012","13,479,479
",userpc@userpc-desktop:~/Pulpit$
我想打印:
"Shimshon A","(blank)","November 24, 2012","13,481"
"jonathan t","Laguna Niguel, CA","November 24, 2012","13,480"
"scott b","Sussex, NJ","November 24, 2012","13,479"
请仅在 awk 中解决。
感谢您的帮助。