laila
laila

Reputation: 1059

sed bash replace ,, with ,

I have a file with the following content:

 {
        "user_id1": "171295",
        "timeStamp": "2017-03-06 19:16:58.000"
    },,
    {
        "user_id1": "149821",
        "timeStamp": "2017-03-08 12:50:47.000"
    },,
    {
        "user_id1": "184767",
        "timeStamp": "2017-03-08 19:55:25.000"
    },,
    {
        "user_id1": "146364",
        "timeStamp": "2017-03-12 23:48:48.000"
    },
]

I want to replace all instances of },, with }, in bash using sed how do I do this?

Upvotes: 0

Views: 99

Answers (2)

Unwastable
Unwastable

Reputation: 679

This is one of the many ways you can do:

sed 's/},,$/},/g' yourfile.txt

$ is an assurance that it's matching end of line's commas. -i option allows you to edit file in place.

sed -i 's/},,$/},/g' yourfile.txt

Upvotes: 2

user933161
user933161

Reputation:

sed 's/},,/},/g' < in > out

Upvotes: 0

Related Questions