regex - Replace one letter in string -
i have text file on 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} ] i need write regular expression sed tool find last symbol ] , replace , final rezult be:
[{"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} , thanks in advance.
uodated. help, i've checked , workes fine, there situation when tag ] situated in same line expression.
[{"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}] copied comments
i have write regular expression doesn't work sed -i '$s/]$//'
sed 's/]$/,/' should make it.
with $ indicate end of line.
test
$ echo "[{"creati]on_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 's/]$/,/' [{creati]on_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} , where can see if put other ] persist. (in creati]on_time)
Comments
Post a Comment