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?


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?