Some sed scripts
1. For Math (for (2.0) stackel space)
Replacing "Derivative[1][...]" to 'sed "s/Derivative\[1\]\[\(.\)\]/\1\'/g" file1>file2 sed "s/Derivative\[2\]\[\(.\)\]/\1\'\'/g" file2>file3Deleting newline charasters
sed ':a;{N;s/\n/ /;b a}' file3>file4Deleting LF, spaces, pasting true newlines
sed 's/^M//g;s/ \+//g;s/;/;\n\n/g' file4>file5(вдохновлено: Краткий учебник по sed от drBatty)