I have copy-pasted the JSON structure into a .txt file for my input file (I will have a number of these).
I'm looking for the "Name" text between "start" and "end", my input file is large and the parts I want to extract from look like this:
Here: "start",
title: "Name",
type: "end",
words: "more words",
I've tried the following but it doesn't work.
input.txt < sed -n '/^start",$/,/^type: "end"$/p' data > output.txt
Thank you.
data.txt
...
Here: "start",
title: "Name",
type: "end",
words: "more words",
...
Sed command:
$ sed -n '/start",$/,/ *type: "end",$/p' data.txt
Output:
Here: "start",
title: "Name",
type: "end",
^ won't match the start line since there's a "Here:" before it and "end"$ won't match the end line since there's a comman after the last quotation mark.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With