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;

enum Day {
    Sun, Mon, Tue, Wed,
    Thu, Fri, Sat 
}



public class PrepareFile {
	
	public static void main(String [] args){
		
		
		Iterator it = FileUtils.iterateFiles(new File("K:\\CSU Node Data\\CS_Linux\\01_2012\\"), null, false);
		
        while(it.hasNext()){
           //System.out.println(((File) it.next()).getName());

        	String fileName =((File) it.next()).getName();

		
		
		PrintWriter pw = null;
		
		try{
			
			int lineCount=0;

			
			BufferedReader in = new BufferedReader(new FileReader("K:\\CSU Node Data\\CS_Linux\\01_2012\\"+fileName));
			
			pw = new PrintWriter(new FileWriter("K:\\CSU Node Data\\CS_Linux\\01_2012_first\\"+fileName));
			String MacAddr = in.readLine();
			pw.println(MacAddr);
			String prevString="";
			String nextString="";
			int skip = 0;
			while(nextString !=null)
			{
				skip =0;
				nextString = in.readLine();
				
				if(nextString.equals(MacAddr) && (!(prevString.equals(""))))
				{
							
					pw.println("");
					pw.println("");
					pw.println("");
				}
				prevString =nextString;
				
				
				if(nextString.contains("RX bytes:"))
				{
					
					nextString = nextString.trim();
					
					String[]token1 = nextString.split("RX bytes:");
					String[] token2= token1[1].split(" ");
					String RxBytes=token2[0];
					
					pw.println(RxBytes);
					
					token1 = nextString.split("TX bytes:");
					token2 = token1[1].split(" ");
					String TxBytes=token2[0];
					
					pw.println(TxBytes);
				
					
					skip =1;
				}
				
				
				if(nextString.contains("Core(TM)"))
				{
					String [] coreTokens = nextString.split("CPU");
					nextString =coreTokens[0]+" "+coreTokens[1].trim();
					
				}

				if(nextString.contains("load average"))
				{
					
					String [] tokens = nextString.split(",");
					
					nextString = tokens[0] + ","+tokens[1];  
					
				}
				
				
				if(nextString.contains("Cpu(s):"))
				{
					
					String [] tokens1 = nextString.split(":");
					
					
					String [] tokens2 = tokens1[1].split(",");
					
					
					nextString ="";
					nextString = tokens2[0].trim().replace("%us","\t");
					nextString = nextString + tokens2[1].trim().replace("%sy","\t");
					nextString = nextString + tokens2[2].trim().replace("%ni","\t");
					nextString = nextString + tokens2[3].trim().replace("%id","\t");
					nextString = nextString + tokens2[4].trim().replace("%wa","\t");
					nextString = nextString + tokens2[5].trim().replace("%hi","\t");
					nextString = nextString + tokens2[6].trim().replace("%si","\t");
					nextString = nextString + tokens2[7].trim().replace("%st","");
					
					
				}

				
				if(skip!=1)
				pw.println(nextString.trim());

	
				
			}
			
			
			
		}
		catch(Exception e){
			
			
			System.out.println(e);
			pw.close();
		}
        }
	}

}