#!/usr/bin/perl -w # Remove extra text from a PGN or Text-file. # Aufruf: perl remove2.pl TestEK.txt > Out.txt # This is TestEK.txt: # 1. Ka6 ({Of course not} 1. b6 $2 Kb7 $11) 1... Kb8 (1... f4 2. b6 $18) {[%tqu "What is White's next move?","","",g3,"",0,b6,"misses the win:",0]} 2. g3 $1 13. g6 c3 # This should be the Out.txt # 1. Ka6 ({Of course not} 1. b6 $2 Kb7 $11) 1... Kb8 (1... f4 2. b6 $18) } 2. g3 $1 13. g6 c3 use strict; my $regex =/\{\[%tqu .* ]}/; my $subst = //; while(<>) { my $line = $_; s/$regex/$subst/gi; }