Reputation: 31
I have a file having single line (actually a very long line) as shown below:
{worda:wordB:[{"wordc","active":true},}{:wordb:"words","wordt""wordu""wordv","active":true} and so, on.
In this line, one pattern that is common is '"active":true'. I am trying to break this single line into multiple lines based upon this pattern.
Required output: {worda:wordB:[{"wordc","active":true} {:wordb:"words","wordt""wordu""wordv","active":true}
I tried sed and awk, however, either it is resulting into a 0 Kb file after processing or same file as the input file.
I have Windows environment and using GNU sed/awk for the same.
Please help.
Upvotes: 0
Views: 174
Reputation: 4043
$ sed 's/true}.*{/true}\n{/' file
{worda:wordB:[{"wordc","active":true}
{:wordb:"words","wordt""wordu""wordv","active":true}
Brief explanation,
use sed
to substitute true}.*{
to true}\n{
, where .*
would be treated any characters, and \n
would be the newline character
Upvotes: 0