in reply to Empty output file with Red Hat

Does the script fail silently, or do you get an error message? And if it fails silently, do you suppose you might be able to add some error checking to the script so that it will complain if something goes wrong? You're going to need to uncover and report to us some clues before anyone can meaningfully help you to ascertain what's wrong.

Also, is there any way you can post relevant portions of the code, or at least a small example script that replicates the failure? Otherwise, we're only going to be able to guess, and you don't really want to settle for guesses when by providing a little more background you could get accurate answers.


Dave

Replies are listed 'Best First'.
Re^2: Empty output file with Red Hat
by vineet2004 (Initiate) on Dec 26, 2006 at 05:19 UTC
    #!usr/bin/perl while(<>) { if (/ (\w\w) (\w\w) (\w\w) (\w\w) (\w\w) (\w\w) (\w\w) (\w\w) (\w\w) +(\w\w) (\w\w) (\w\w) (\w\w) (\w\w) (\w\w) (\w\w) (\w\w) (\w\w) (\w\w) + (\w\w) (\w\w) (\w\w) (\w\w) (\w\w) (\w\w) (\w\w) (\w\w) (\w\w) (\w\w +) (\w\w) (\w\w) (\w\w) (\w\w)/) { if ($2=="11") { print "\tBSC -> BTS\tBCCH INFOmation ", $1,$2,$3,$4,$5,$6,$7,$8,$9,$1 +0,$11,$12,$13,$14,$15,$16,$17,$18, $19,$20,$21,$22,$23,$24,$25,$26,$2 +7,$28,$29,$30,"\n"; print "\tMessage discriminator :",$1,"\n"; print "\tMessage type :",$2,"\n"; print "channel number :"; print "\tchannel number :",$3,$4,"\n"; print "\tElement Identifier :",$14,"\n"; print "system info Type :",$7,$8,"\n"; print "\tElement Identifier :" ,$7,"\n"; print "\tsystem info Type :", $8,"\n"; print "Full BCCH Info :",$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$1 +8,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,"\n"; } elsif ($2=="34") { print "\tBSC -> BTS\tSACCH INFO MODIFY ", $1,$2,$3,$4,$5,$6,$7,$8,$9 +,$10,$11,$12,$13,$14,$15,$16,$17,$18, $19,$20,$21,$22,$ +23,$24,$25,$26,$27,$28,$29,$30,"\n"; print "\tMessage discriminator :",$1,"\n"; print "\t Message type :",$2,"\n"; print "channel number :"; print "\tchannel number :",$3,$4,"\n"; print "system info Type :",$7,$8,"\n"; print "\tElement Identifier :",$7,"\n"; print "\tsystem information :",$8,"\n"; print "L3 INFORMATION :",$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18 +,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,"\n"; } elsif ($2=="13") { print "\tBSC -> BTS\tCHAN_RQD ", $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$ +12,$13,$14,$15,$16,$17,$18,$19,$20,$21,"\n"; print "\tMessage discriminator :",$1,"\n"; print "\t Message type :",$2,"\n"; print "channel number :"; print "\tchannel number :",$3,$4,"\n"; print "\t Identifier :",$3,"\n"; print "\tRequest Reference :",$5,$6,$7,$8,"\n"; print "\tElement Identifier :",$5,"\n"; print "\tRandom access information :",$6,"\n"; print "\tFrame number modulo :",$7 ,$19,"\n"; print "Access delay :",$9,$10,"\n"; print "\tElement indentifier :",$9,"\n"; print "\tAccess delay :",$10,"\n"; } elsif ($2 =="33") { print "\t BTS -BSC\tRF_CHAN_REL_ACK : ",$1,$2,$3,$4,"\n"; print "BTSM Header : "; print "\tmesssage Discriminator :", $1,"\n"; print "\tMessage Type :\t", $2,"\n"; print "channel number :"; print "\tchannel number :",$3,$4,"\n"; print "\tElement indentifier :",$3,"\n"; } elsif ($2=="22") { print "\tBSC -> BTS\tCHAN_ACTIV_ACK : " , $1 , $2, $3 , $4 , $5 , $ +6 , $7, "\n"; print "BTSM Header : "; print "\t;messsage Discriminator :" , $1,"\n"; print "\tMessage Type : \t", $2,"\n"; print "channel number :"; print "\tchannel number : ", $3 , $4,"\n"; print "\tElement indentifier :",$3,"\n"; print "\tFrame number :" ,$5, $6 , $7,"\n"; print "\tElement indentifier :" , $5, "\n"; } elsif ($2=="21") { print "\tBSC -> BTS\tCHAN_ACTIV :",$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11 +,$12,$13,$14,"\n"; print "BTSM Header : "; print "\tmesssage Discriminator :",$1,"\n"; print "\tMessage Type :\t",$2,"\n"; print "channel number :"; print "\tchannel number :",$3,$4,"\n"; print "\tElement indentifier :",$3,"\n"; print "\tActivation type :",$5,$6,"\n"; print "\tElement indentifier :",$5,"\n"; print "\tChannel mode :",$7,$8,$9,$10,$11,$12,"\n"; print "\tElement indentifier :",$17,"\n"; print "\tLength :",$18,"\n"; print "\tTiming Advance :" ,$13,$14,"\n"; print "\tElement indentifier :",$13,"\n"; } } }

    20061226 Janitored by Corion: Added code tags, as per Writeup Formatting Tips

      To avoid puzzling problems with missing data files, test your input with something along these lines:

      #!/usr/bin/perl if (!defined $ARGV[0]) { # make sure some input is given die "No input file provided: $!"; } elsif (!-f $ARGV[0]) { # input is not a file die "Input $ARGV[0] not available as a file"; }
      Then you'll know when you've got no data file to work on.

      Also suggested is the use of "use warnings" and "use strict" at the beginning of nearly every Perl program.

      non-Perl: Andy Ford

A reply falls below the community's threshold of quality. You may see it by logging in.