otherdata
otherdata
start_data
one
two
three
four
end_data
otherdata
otherdata
The resulting output should just be:
one
two
three
four
This looked like a job for sed to me:
sed -n '/start_data/,/end_data/{1d;$d;p}' myfile
Did not work. First line was deleted, but not the last line! (for no reason that I could explain by logic so far)
OK, so let's try the ugly way:
sed -n '/start_data/,/end_data/{/start_data\|end_data/!p}' myfile
Fair enough, this works. But I'd like to make the shorter method work as well, as the resulting output will always contain the two patterns on first and last line, since we're only extracting the data in between.
Why does sed choke at the attempt of combining the 1d and $d statements in curly braces?