Reputation: 4985
Open ended question (be creative!) for a real use case. Essentially I want to cat (1) an existing file (2) the output of a program and (3) a specific bit of text. Between pipes, echo and redirects, I feel like I should be able to do better than this!
pandoc -t latex -o mydoc.tex mydoc.rst
echo \\end{document} > footer.tex
cat header.tex mydoc.tex footer.tex > fulldoc.tex
Upvotes: 1
Views: 118
Reputation: 246807
If you're using bash, you can use process substitution and a here string:
cat header.tex <(pandoc -t latex mydoc.rst) <<<'\end{document}' > fulldoc.tex
Upvotes: 1
Reputation: 798676
{
cat header.tex
pandoc -t latex mydoc.rst
echo \\end{document}
} > fulldoc.tex
Upvotes: 7