[英]sed to replace comma and new line
I'm trying to replace this 我正试图取代它
colb,
cola,
)
with this 有了这个
colb,
cola
)
in sed, but can't seem to get it to work. 在sed,但似乎无法让它工作。 I've tried both of these but nothing seems to happen
我已经尝试了这两种,但似乎没有任何事情发生
sed -e 's/, \n)/\n)/g'
sed -e 's/,\n)/\n)/g'
I can get a new line to replace but I can't get a comma followed by a newline followed by ) to replace with just a newline followed by ) 我可以获得一个新的替换,但我不能得到一个逗号,后面跟一个换行符替换只有一个换行后跟)
Extending on the solution from near-duplicate , this does work: 从近似重复扩展解决方案,这确实有效:
sed ':a;N;$!ba;s/,\n)/\
)/g'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.