我在 unix 上有一些文本文件:
[{"creation_time":"2013-04-18 12:03:33","id":255,"type_id":100,"workflow":167000440},
{"creation_time":"2013-04-18 12:03:33","id":255,"type_id":100,"workflow":167000441}
]
我需要使用 SED 工具编写正则表达式,找到最后一个符号 ] 并将其替换为 ,因此最终结果将是:
[{"creation_time":"2013-04-18 12:03:33","id":255,"type_id":100,"workflow":167000440},
{"creation_time":"2013-04-18 12:03:33","id":255,"type_id":100,"workflow":167000441}
,
提前致谢。
已过期。谢谢大家的帮助,我已经检查过了,它工作正常,但是当 tag ] 与我的表达式位于同一行时,可能会出现一些情况。
[{"creation_time":"2013-04-18 12:03:33","id":255,"type_id":100,"workflow":167000440},
{"creation_time":"2013-04-18 12:03:33","id":255,"type_id":100,"workflow":167000441}]
复制自评论
我已经写了这个正则表达式,但它不起作用sed -i '$s/]$//'