I have test.json
file with different lengths of rows. Some fictitious example:
{ a: 123, b: sd, c: x45, d: 1, e: '' }
{ a: 5, b: bfgg, c: x4c, d: 31, e: '' }
I want to cut the whole substring after d
– part and get back just for every line:
{ a: 123, b: sd, c: x45 }
{ a: 5, b: bfgg, c: x4c }
I found here a similar question and tried to adapt my problem to it:
echo test.json | sed 's/. d:/' > newtest.json
I need to do it for the whole file, not only one line.
Best Answer
it will walk through the whole file and remove on each line with
d:
all, d:.*
part till}
symbol (}
symbol will stay on the line).