import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.Iterator;

import org.apache.commons.io.FileUtils;

public class FinalFormat {

	public static void main(String args[]){
		
		Iterator it = FileUtils.iterateFiles(new File("K:\\CSU Node Data\\CS_Linux\\01_2012_first\\"), null, false);
		
        while(it.hasNext()){
        	
        	String fileName =((File) it.next()).getName();
        
		PrintWriter pw = null;
		try{
			
			BufferedReader in = new BufferedReader(new FileReader("K:\\CSU Node Data\\CS_Linux\\01_2012_first\\"+fileName));
			pw = new PrintWriter(new FileWriter("K:\\CSU Node Data\\CS_Linux\\01_2012_output\\"+fileName));
			pw.println("MacAddr" +"\t"+"IPaddr"+"\t"+"Interface"+"\t"+"Model"+"\t"+"NumCores"+"\t"+"ProcSpeed"+"\t"+"Vendor"+"\t"+"cacheSize"+"\t"+"RamSize"+"\t"+"MemAvail"+"\t"+"MemUsedPerc"+"\t"+"MemFreePerc"+"\t"+"SwapAvail"+"\t"+"SwapUsed"+"\t"+"Uptime"+"\t"+"FileSystem"+"\t"+"MaxSpace"+"\t"+"FreeSpace"+"\t"+"OsName"+"\t"+"OSDescription"+"\t"+"OSArch"+"\t"+"OsVersion"+"\t"+"Time"+"\t"+"OneMinAvg"+"\t"+"FiveMinAvg"+"\t"+"FifteenMinAvg"+"\t"+"MTU"+"\t"+"RX bytes"+"\t"+"TX Bytes"+"\t"+"CPU flags"+"\t"+"Num Process Extracted"+"\t"+"Process Name"+"\t"+"Proc Cpu Util"+"\t"+"Proc Mem Util");
			String FirstString="";

			int count = 0;
			while(FirstString !=null )
			{
				FirstString = in.readLine();
				count++;
				
				while(FirstString.trim().length() != 0)
				{
					
					pw.print(FirstString +"\t");
				
					FirstString = in.readLine();
					count++;
					
					
				
				}
				
				
				while(count <43)
				{
					pw.print("null"+"\t");
					count++;
				}
				
				count =0;
				
				
				pw.println("");

				FirstString = in.readLine();
				FirstString = in.readLine();

				//count 
			}
		}catch(Exception e){
			
		}
		
		finally{
			pw.close();
		}
		
	}
	}
	
}
