Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^6: Parsing Data logger files ...

by RedTussock (Acolyte)
on Oct 07, 2012 at 04:43 UTC ( #997659=note: print w/ replies, xml ) Need Help??


in reply to Re^5: Parsing Data logger files ...
in thread Parsing Data logger files ...

Yep OK, Sorry for the delay I had to pick family up of the plane ... The code offered creates afile indeed it does ... but It chokes on multiple files I think ... I get this result

Smitty@smittytech:~/scripts/perl/dl_parser> perl lineJumper.pl /home/S +mitty/scripts/perl/dl_parser/down/* Use of uninitialized value in join or string at lineJumper.pl line 12, + <> chunk 478. Use of uninitialized value in join or string at lineJumper.pl line 12, + <> chunk 478. Use of uninitialized value in join or string at lineJumper.pl line 12, + <> chunk 478. Use of uninitialized value in join or string at lineJumper.pl line 12, + <> chunk 478.
which I think is the script not liking multiple files to parse ?? ..


Comment on Re^6: Parsing Data logger files ...
Download Code
Re^7: Parsing Data logger files ...
by kcott (Abbot) on Oct 07, 2012 at 05:51 UTC

    G'day RedTussock,

    Welcome to the monastery.

    I'm reasonably certain that your problem is in map qq/"$_"/, @fields[ 0 .. 5 ] and is probably caused by @fields not containing 6 elements. Here's some troubleshooting hints.

    Check the files you're reading (i.e. ls -l /home/Smitty/scripts/perl/dl_parser/down/*). Are all of these the files you want? Perhaps use *.txt (or similar) to limit the files you're processing.

    Do all of the files have the format you're expecting? You may be able to check this by inspection. If not, add some debugging code around while (<>) { like this:

    my $last_file = ''; while (<>) { print "$ARGV\n" if $ARGV ne $last_file; $last_file = $ARGV;

    [perlop - I/O Operators explains <> and $ARGV]

    You should see something like:

    some_file_name another_file_name Use of uninitialized value in ... different_file_name Use of uninitialized value in ...

    You'll now know which files are causing the problems and you can focus your investigation accordingly.

    -- Ken

      Yup that was the issue alright ... Hey thanks guys. I feel like I have used you as code writers, but it helped out heaps, and got a small unpaid job done out of my hair. See another "thing" I am trying to do here at home with a 1 wire weather station. I would love to be able to read the sensors direct using perl and upload a data file ... will post in another question though. BUT a big thanks for you help.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://997659]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (11)
As of 2014-09-18 21:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (124 votes), past polls