Search code examples
jsonlinuxloggingcut

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


Solution

  • This did the work:

    less file.json | awk -F ' {' '{printf("{%s}\n", $2)}' > result.json