Thread Quoting-Problem
(6 answers)
Opened by Kevin31 at 2009-06-19 13:51
perl selber bietet alles was du brauchst:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #!/usr/bin/perl use strict; use warnings; my $file='/etc/hosts'; my $tmpmainvillage='Entenhausen'; my @list; open(my $fh, '<', $file) or die "Error open $file ($!)\n"; while(my $line=<$fh>) { push(@list,$line) if($line=~m/#village $tmpmainvillage/); } close($fh); print join("\n",@list)."\n"; In diesem Fall brauchst du keine externen Befehle. |