Thread Datei öffnen und Strings ersetzen (3 answers)
Opened by Willi9974 at 2016-07-07 00:15

GwenDragon
 2016-07-07 09:06
#185038 #185038
User since
2005-01-17
14760 Artikel
Admin1
[Homepage]
user image
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)

View full thread Datei öffnen und Strings ersetzen