Article 5J3Z2 Split a Json file using Bash Script

Split a Json file using Bash Script

by
mohankrrishna
from LinuxQuestions.org on (#5J3Z2)
I have a json file , unfortunately the entire message is coming in one line. I need to identify a string in the line (say "WARNING") and split the file into two files.

example :
{"school_name":"ABC","Class":"Senior","Batch":"A","MESSAGE":"Life is short make most of it","WARNING":"Dont sit all day working"}

Expected Result :

File 1:
{"school_name":"ABC","Class":"Senior","Batch":"A","MESSAGE":"Life is short make most of it"}

File 2:
{"school_name":"ABC","Class":"Senior","Batch":"A","WARNING":"Dont sit all day working"}

I Tried Csplit , awk and all but I am going wrong some where.

Someone can help?latest?d=yIl2AUoC8zA latest?i=SU5IHkEy3pY:Dmvg28IaWlo:F7zBnMy latest?i=SU5IHkEy3pY:Dmvg28IaWlo:V_sGLiP latest?d=qj6IDK7rITs latest?i=SU5IHkEy3pY:Dmvg28IaWlo:gIN9vFwSU5IHkEy3pY
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments