View Full Version : Perl nOOb needs help parsing a file
egiggey
11-07-03, 10:40 AM
Hi all
I have a file i need to loop through and remove all occurences of "=0D"
or "=0=" could some one help me out with this
Millennium
11-07-03, 11:50 AM
Hi all
I have a file i need to loop through and remove all occurences of "=0D"
or "=0=" could some one help me out with this
if its a regular text file you should use Tie::File if its on your server (newer version of Perl have it). Something like:
#!/usr/bin/perl
use Fcntl;
use TIE::FILE;
$pathtofile = 'the/path/to/the/file.txt';
tie @DATA, 'Tie::File', $pathtofile, mode => O_RDWR || die "Can't Open $pathtofile: $!\n";
s/=0D|=0=//g for @DATA;
untie(@DATA);
vBulletin® v3.6.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.