in reply to sed deleting file
Why use sed at all, you can do it all in Perl?
knoppix@Microknoppix:~$ perl -Mstrict -wE ' > my $pbxiplp = <<EOF; > (3.3.3.3,4.4.4.4,) > EOF > print $pbxiplp; > > my $pbxiplp1; > open my $inFH, q{<}, \ $pbxiplp or die $!; > open my $outFH, q{>}, \ $pbxiplp1 or die $!; > while ( <$inFH> ) > { > s{ , (?= \) ) }{}; > print $outFH $_; > } > close $inFH or die $!; > close $outFH or die $!; > > print $pbxiplp1;' (3.3.3.3,4.4.4.4,) (3.3.3.3,4.4.4.4) knoppix@Microknoppix:~$
I'm using scalar refs. here as I'm doing this on the command line but it would work just as well with real files.
I hope this is helpful.
Cheers,
JohnGG
|
|---|