in reply to Re^3: Substitution don't work with a special inputfile
in thread Substitution don't work with a special inputfile
Hi poj, thank you so much for your help, this is the first solution that does the job, but only, when the newlines were also re-inserted in the so called Header or tags, that are the strings starting with a square bracket. As you might have supposed, its a special text file with chess moves, but each of the square brackets has to be on its own line, otherwise a chess program can not interpret the file. As I'm new to perl, I have to work hard to understand your code, but I will try my best. The line: $line =~ s/ (\d+\. )/\n$1/g; does to my understanding the job of re-inserting the newlines but only with the numbered lines. I have added the line: $line =~ s/ (\[ )/\n$1/g; and I had hoped this will re-install the newlines for the tags, but for no good. If you can post a solution with newlines also for the tags, I would be very thankful to you.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Substitution don't work with a special inputfile
by AnomalousMonk (Archbishop) on Aug 24, 2015 at 18:55 UTC | |
|
Re^5: Substitution don't work with a special inputfile
by poj (Abbot) on Aug 24, 2015 at 18:09 UTC | |
by OldChamp (Acolyte) on Aug 25, 2015 at 08:40 UTC |