Hi All,
I have a parser that reads in ftp logs and does an insert into a database. Everything parses, and inserts fine. However, on occasion, a user has created a file or file path with whitespace in the name, i.e. - "/userhome/my files/bigfile".
The parser picks up the whitespace between "my files" in this example and the variable $path is incomplete and all other variables shift over. Therefore the wrong data is inserted into the wrong table in the database. Does anyone have a suggestion on how to check for whitespace in the file path and account for it? Is there a way to ignore the white space for this place in the log file only? Any help is appreciated =)
Here is the snippet of code for reading the log file:
#while (<>) {
while (<FILE>) {
($dow, $month, $day, $time, $year, $duration, $clientip, $size, $path, $ttype, $specialact, $type, $mode, $uid, $service, $authm, $authu, $status) = split(/\s+/);
Thanks in advance.
Icky
I have a parser that reads in ftp logs and does an insert into a database. Everything parses, and inserts fine. However, on occasion, a user has created a file or file path with whitespace in the name, i.e. - "/userhome/my files/bigfile".
The parser picks up the whitespace between "my files" in this example and the variable $path is incomplete and all other variables shift over. Therefore the wrong data is inserted into the wrong table in the database. Does anyone have a suggestion on how to check for whitespace in the file path and account for it? Is there a way to ignore the white space for this place in the log file only? Any help is appreciated =)
Here is the snippet of code for reading the log file:
#while (<>) {
while (<FILE>) {
($dow, $month, $day, $time, $year, $duration, $clientip, $size, $path, $ttype, $specialact, $type, $mode, $uid, $service, $authm, $authu, $status) = split(/\s+/);
Thanks in advance.
Icky