File prepending magic
01 Mar 2016To prepend some text at the start of each file, use sed:
sed -i '1i <pattern>' <files>
Useful examples:
Add emacs headers for LaTeX mode:
sed -i '1i % -*- mode:LaTeX; mode:visual-line; mode:flyspell -*-' *.tex
To prepend some text at the start of each file, use sed:
sed -i '1i <pattern>' <files>
Add emacs headers for LaTeX mode:
sed -i '1i % -*- mode:LaTeX; mode:visual-line; mode:flyspell -*-' *.tex