Im trying to write a line of text to a file but when i do this the text is
written but onto the front of the next line. I want it to write the text
into the file on its own line after the found line!
The below code is replacing the regular expression with the line of text
(which is not what i want) so that my file line then becomes:
This is a test5.0.1/255.255.255.255 -d 0.0.0.0/0.0.0.0 22:22 -p 6 -j ACCEPT
Instead of:
-A input -s 10.5.0.1/255.255.255.255 -d 0.0.0.0/0.0.0.0 22:22 -p 6 -j ACCEPT
This is a test
______CODE_________
open(IPCHAINS,"+</etc/sysconfig/ipchains") || die "Unable to open ipchains:
$!";
while($line = <IPCHAINS>) {
if($line =~ /^-A input/) {
print IPCHAINS "This is a test";
last;
}
}
close(IPCHAINS);
_________END_________
Thanks
Rob
--
Email Disclaimer can be viewed at:
http://www.netscalibur.co.uk/email.html
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]