- --- In perl-beginner@y..., Jorge Goncalvez <goncal11@c...> wrote:
> HI, I have a file like this:= 0xBF : RRQ
> 1015322638: in.tftpd : Win32 Process Id = 0xBF : Cygwin Process Id
> from 126.96.36.199 filename /bootp/linux/4.0/alize/initrd.img(in.tftpd)
> .....188.8.131.52 and what
> And I wanted to match what is between from and filename ie
> comes after filemane ie /bootp/linux/4.0/alize/initrd.imgAs you don't say if all the lines will have exactly the same data or
> without (in.tftpd)
> How can I do thanks to a regexp.
whether you only wish to match one line in the whole file...
Maybe split on the colons:
$Line = '1015322638: in.tftpd : ..etc.. (in.tftpd)';
my @SplitLine = split( /\s*:/s*/, $Line;
# $SplitLine = 'RRQ ..etc.. (in.tftpd)'
# You can either split on spaces
my $filename = ( split( /\s+/, $SplitLine ) );
# or use a reg exp.
$SplitLine =~ /^RRQ from [\d|\.]+? filename (.*?) \(in/;
$filename = $1;
I didn't check this code so there may be incorrect indices on the
And I'm sure others will have other/better solutions.