I was thinking too complicated the slicing in the How to express variables efficiently for SED? I want to include (a,b), not [a,b] like this don_crissti's command:
sed '/begin{document}/,/end{document}/!d;/end{document}/q' data.tex
So I do not want to include \begin{document} and \end{document} in the output.
How can you having an open interval in the output?
{:;n;/end{document}/!{p;b;};}? It is rather cryptic to me. – Léo Léopold Hertz 준영 Sep 11 '15 at 14:15:— mark;n— get next line ;/end{document}/!— line, which not (!) consist pattern;p— print ;b— return to mark – Costas Sep 11 '15 at 14:40b? – Léo Léopold Hertz 준영 Sep 11 '15 at 14:52