Skip to content
Advertisement

Linux cut pattern from log file

i have json log file but theres not only json i need to cut/remove everything what isnt json, structure looks like this:

 2010-10-10 10:10:10 vibez.dev and here starts json {xxxx:xxxx, etc}
 when json ends, next line with same info begins.

i tried cut -d command but it doesnt work for me

Advertisement

Answer

This did the work:

less file.json | awk -F ' {' '{printf("{%s}n", $2)}' > result.json
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement