<?xml version="1.0" encoding="windows-1252"?>
<node id="966934" title="Reading in two text files" created="2012-04-24 15:52:53" updated="2012-04-24 15:52:53">
<type id="115">
perlquestion</type>
<author id="966193">
Spartan4ever</author>
<data>
<field name="doctext">
I am new to Perl and have a question about handling the output for reading and writing two separate files.

I am reading in Unix/AIX/Linux dflog files and them performing calculations on the space utilization of the individual file systems.

The section of my code reads as follows:
&lt;c&gt;
open( firstfile, "DFLOG1.txt");
open( secondfile, "DFLOG2.txt");

while (&lt;firstfile&gt;) {
		chomp;
		@blines=grep(/dev/, $_);
			foreach $bline (@blines) {
				@BRead = split(" ", $bline);
				$bmount = $BRead[0];
				$btotdsk = $BRead[1];
				$buseddsk = $BRead[2];
				$bfreedsk = $BRead[3];
			}
while (&lt;secondfile&gt;) {
			chomp;
			@elines=grep(/dev/, $_);
			foreach $eline (@elines) {
			@ERead = split(" ", $eline);
			$emount = $ERead[0];
			$etotdsk = $ERead[1];
			$euseddsk = $ERead[2];
			$efreedsk = $ERead[3];
		}
print (OUTFILE " ,$bmount, $btotdsk, $busedsk, $bfreedsk, $etotdsk, $euseddsk, $efreedsk\n");
&lt;/c&gt;

Where I am having difficulty is getting the lines of the two files to sync.  Depending on where I place my print statement I either get the last filesystem entry from the first file being compared to all the filesystems in the second or vice verse.

Any insight as to how to correct my issue is greatly appreciated.</field>
</data>
</node>
