G
gniagnia
Hi all,
here is an extract of the log file my perl script handles:
2007/02/15 17:59:22 192.168.0.12 ftpuser1 STOR 436699136 /ftp-data/
expl/data/out/region1/ftpuser1/fichier ftp de test.txt
2007/02/15 18:29:22 192.168.0.12 ftpuser1 STOR 436699136 /ftp-data/
expl/data/out/region1/ftpuser1/video.mpg
2007/02/15 17:46:31 192.168.0.12 ftpuser1 RETR - -
etc...
I'd like to record the file name at the end of each line, in an array,
in order to have :
fichier ftp de test.txt
video.mpg
etc...
So far, I manage to write this script :
push(@ftpfilesout,$1) if ( $ftpd_line =~ m:/([^/]*\S)\s*$: ) ;
foreach $ftpfileout (@ftpfilesout)
{
print "$ftpfileout";
}
But there is a problem when the script finds a line like this one :
2007/02/15 17:46:31 192.168.0.12 ftpuser1 RETR - -
(that is to say a line that doesnt contain any file name at the
end...)
How can I improve my script to bypass all lines that doesnt contains
any file name at the end?
I think the best way to do it is to record all element situated after
the 9th "/"
But I dont know how to write this...
Thanks in advance for your help!
here is an extract of the log file my perl script handles:
2007/02/15 17:59:22 192.168.0.12 ftpuser1 STOR 436699136 /ftp-data/
expl/data/out/region1/ftpuser1/fichier ftp de test.txt
2007/02/15 18:29:22 192.168.0.12 ftpuser1 STOR 436699136 /ftp-data/
expl/data/out/region1/ftpuser1/video.mpg
2007/02/15 17:46:31 192.168.0.12 ftpuser1 RETR - -
etc...
I'd like to record the file name at the end of each line, in an array,
in order to have :
fichier ftp de test.txt
video.mpg
etc...
So far, I manage to write this script :
push(@ftpfilesout,$1) if ( $ftpd_line =~ m:/([^/]*\S)\s*$: ) ;
foreach $ftpfileout (@ftpfilesout)
{
print "$ftpfileout";
}
But there is a problem when the script finds a line like this one :
2007/02/15 17:46:31 192.168.0.12 ftpuser1 RETR - -
(that is to say a line that doesnt contain any file name at the
end...)
How can I improve my script to bypass all lines that doesnt contains
any file name at the end?
I think the best way to do it is to record all element situated after
the 9th "/"
But I dont know how to write this...
Thanks in advance for your help!