Search code examples
regexperlawksedgawk

how to edit following line in sed, awk or anything else


how to edit following line in sed, awk or anything else:

root@laptop002:/tmp# cat /tmp/log
2016-03-01 06:08:26     {"id":"778640","cuid":"1","msid":"199033","lid":"582","Started":"1","qid":"9401"}  batch is running 

to make it look like following:

2016-03-01 06:08:26     "msid":"199033"  batch is running 

or

2016-03-01 06:08:26     msid is 199033  batch is running 

or

2016-03-01 06:08:26     msid=199033  batch is running 

Solution

  • $ awk -F'[{,}]' '{print $1, $4, $NF}' file
    2016-03-01 06:08:26      "msid":"199033"   batch is running