Is it possible to use more than one format in a script? I am parsing a log file to 
STDOUT and would like to be able to write to two (or more) different formats depending 
on the information found in the log. 

This is what I'm trying to do:

1. open and read logfile
2. if you find "some_string" print to STDOUT using TYPE_1 format
3. if you find "other_string" print to STDOUT using TYPE_2 format
5. continue parsing logfile, etc

I can open and parse the logfile, my script breaks whenever I try to call more than 
one type of format. This doesn't seem to work for me, is this even possible?


format TYPE_1 =
Type: @<<<<<<<<<<  Gateway: @<<<<<<<<<  Acct ID: @<<<<<<<<<<<<<<<<<<
$record_type,$gateway,$acct_id
Start Date: @<<<<<<<<<<  Start Time: @<<<<<<<<<
$start_date,$start_time
.
write TYPE_1;

format TYPE_2 =
Type: @<<<<<<<<<<  Gateway: @<<<<<<<<<  Acct ID: @<<<<<<<<<<<<<<<<<<
$record_type,$gateway,$acct_id
Start Date: @<<<<<<<<<<  Start Time: @<<<<<<<<<
$start_date,$start_time
Disconnect Date: @<<<<<<<<<<  Disconnect Time: @<<<<<<<<<
$disco_date,$disco_time
.
write TYPE_2;


Also, how would I go about keeping the filehandles open as it would be repetively 
"writing" each format.


Thank you,
Jose

Reply via email to