Thread Datei öffnen und Strings ersetzen
(3 answers)
Opened by Willi9974 at 2016-07-07 00:15
beispielsweise so:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 my $filename = shift @ARGV; die "Missing filename" if not defined $filename; open (my $fh_out, '>', $filename . '.converted') or die "Cant open - $!"; open (my $fh_in, '<', $filename) or die "Cant open - $!"; while (my $line = <$fh_in>) { # ;>text12345</a> <a href= $line =~ s|>([^<]+)</a> <a href=|$1|g; print $fh_out $line or warn "Cant write - $!"; } close $fh_in or die "Cant close - $!"; close $fh_out or die "Cant close - $!"; Last edited: 2016-07-07 09:09:13 +0200 (CEST) |