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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -