Hi, I am trying to modify a LaTex file which is plain text. The file contains lines similar to the following, but each line is followed by text, so that:
Article 1 Cats Article 2 Dogs Article 3 Fish Article 4 Ferrets etc. I would like to modify the file so that each referenced line is changed as follows: \subsection*{Article 1 Cats} \subsection*{Article 2 Dogs} \subsection*{Article 3 Fish} \subsection*{Article 4 Ferrets} Here's code which was suggested to me, but when I execute it I'm returned to the command line and nothing happens: #!/usr/bin/perl s/^(Article\s+[0-9]+\s+\N*\S)/\\subsection*{$1}/gm I called this script "Article" and saved it as article.pl The usage then was $perl article.pl oldfile.tex newfile.tex and I got the following error message: Missing braces on \N{} at article.pl line 2, within pattern Nested quantifiers in regex; marked by <-- HERE in m/^(Article\s+[0-9]+ \s+* <-- HERE \S)/ at article.pl line 2. So I added braces as follows: \{N} I ran the script again; there was no error message but no newfile.tex either. I then ran the program as follows: $perl article.pl oldfile And the response is the command prompt and the file hasn't been modified. any suggestions? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/