^^^ is what I have. i have to generate a report for management that looks similar to this, but consolidates each set of four rows and eliminates many of the columns. Your report should be an output file created by your Perl code. The columns to keep in your report are the following:my $infile = "COSC146_project01_dataset_2.txt"; #project input file. my $outfile = "fileoutput.txt"; # assigned an output file. open FILE,$infile or die "failed to open!"; #open project text. open OUT, ">fileoutput.txt" or die "failed to output!"; my $line = undef; #read line by line. Assigned global value to the sca +lar line. my $text = <FILE>; # Split on spaces. my @items = split ' ', $text; use Data::Dumper; #print Dumper(@items); print "$items[0]\t"; print "$items[2]\t"; print "$items[1]\t"; print "$items[3]\t"; print "$items[18]\t"; print "$items[23]\t"; print "$items[34]\t"; print "$items[36]\t"; print OUT "$items[0]\t"; print OUT"$items[2]\t"; print OUT"$items[1]\t"; print OUT "$items[3]\t"; print OUT"$items[18]\t"; print OUT "$items[23]\t"; print OUT"$items[34]\t"; print OUT "$items[36]\t";
'Date of Test', 'G400-TYP', 'G400-SN', 'G400-Ver.', 'G400-USER', 'Mode', 'Result', 'DS400-SN.', and 'DS400-Name' Again, re +alize that, for each set of four rows, you may not simply check 'Result' for 'ERR' in the first of each + four-row set. G400-TYP G400-SN. G400-USER G400-Ver. Sensor-Typ Sensor-SNSensor range + A1 A2 A3 STEL TWA LEL-Value STEL-Time Date of Test Mode Test Gas Gas Bottle Res +ult Horn LED tA1 tA2 t50 t90 ZP-before ZP CAL-before CAL DS400-SN. DS400- Name DS400-Ver. DS400-ID G450 09010119 3.44 MK429-00 00000 0.0 - 100.0 ppm H2S 10.0 ppm 30.0 pp +m 15.0 ppm 10.0 ppm 2012-06-20 13:19 CAL 20.0 ppm OK OK OK -0.1 ppm 0.1 ppm 18.8 ppm 20.3 ppm 12063580 -default- 2.21 1 G450 09010119 3.44 MK437-00 00000 0 - 500 ppm CO 35 ppm 50 ppm 50 ppm 35 ppm 2012-06-20 13:19 CAL 200 ppm OK OK OK -1 ppm 0 ppm 203 ppm 200 ppm 12063580 -default- 2.21 1 G450 09010119 3.44 MK427-00 00000 0.0 - 25.0 Vol% O2 19.5 Vol% 17.0 Vo +l% 23.5 Vol% 2012-06-20 13:19 CAL N/A OK OK 20.9 Vol% 20.9 Vol% 12063580 -default- 2.21 1 G450 09010119 3.44 MK221-01 00000 0.0 - 100.0 %LEL CH4 10.0 %LEL 20.0 +%LEL 60.0 %LEL 5.0 Vol% 2012-06-20 13:19 CAL 50.0 %UEG OK OK OK -0.5 %LEL 0.0 %UEG 47.5 %LEL 50.5 %LEL 12063580 -default- 2.21 1 G450 09010119 3.44 MK429-00 00000 0.0 - 100.0 ppm H2S 10.0 ppm 30.0 pp +m 15.0 ppm 10.0 ppm 2012-06-20 13:41 CAL 20.0 ppm OK OK OK -0.3 ppm 0.1 ppm 20.5 ppm 20.3 ppm 12063580 -default- 2.21 1
In reply to How do I seperate my data in this txt file. by perltypeofguy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |