Close. I mean, the regexp is ok, but the LaTeX is not.
You seem to intentionaly match 1.2.3, but as far as I remember, the \subsection{} command of LaTeX is for 1.2 only, 1.2.3 should be a \subsubsection{}. So... s/^\d\+\.\d\+\s\+\(.*\)$/\\subsection{\1\}/ s/^\%(\d\+\.\){2}\d\+\s\+\(.*\)$/\\subsubsection{\1\}/ s/^\%(\d\+\.\){3}\d\+\s\+\(.*\)$/\\subsubsubsection{\1\}/ -- Rodolfo Borges