For Programmers: Free Programming Magazines  


Home > Archive > AWK > February 2008 > parsing output for Excel









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author parsing output for Excel
dwcasey@gmail.com

2008-02-13, 9:58 pm

I run a script that does some checks on many, many servers.

If an error condition exists, I write out to a file ERR: with the
issue that was found. I'm wanting to be able to create some format
from this that will go into a spreadsheet. Really just looking for
ideas on what would be a good way to parse it that would be acceptable
for Excel. Like maybe grab a unique servername and all it's issues?

This is a cat *.out of the servers.out file created by my script.

srv.srv01.out:ERR: dummy not found for LTAPEDEV in pri srv01
srv.srv01.out:ERR: Found 127.0.0.1 on TSM Server in resolv.conf for
TSM srv01
srv.srv02.out:ERR: dummy not found for LTAPEDEV in pri srv02
srv.srv02.out:ERR: directory /dummy not found on filesystem in pri
srv02
srv.srv02.out:ERR: directory /dummy not found on filesystem in bkp
srv02
srv.srv02.out:ERR: Found 127.0.0.1 on TSM Server in resolv.conf for
TSM srv02
srv.srv03.out:ERR: dummy not found for LTAPEDEV in pri srv03
srv.srv03.out:ERR: directory /dummy not found on filesystem in pri
srv03
srv.srv03.out:ERR: directory /dummy not found on filesystem in bkp
srv03
srv.srv03.out:ERR: Found 127.0.0.1 on TSM Server in resolv.conf for
TSM srv03
Ed Morton

2008-02-13, 9:58 pm



On 2/13/2008 8:45 AM, dwcasey@gmail.com wrote:
> I run a script that does some checks on many, many servers.
>
> If an error condition exists, I write out to a file ERR: with the
> issue that was found. I'm wanting to be able to create some format
> from this that will go into a spreadsheet. Really just looking for
> ideas on what would be a good way to parse it that would be acceptable
> for Excel. Like maybe grab a unique servername and all it's issues?
>
> This is a cat *.out of the servers.out file created by my script.
>
> srv.srv01.out:ERR: dummy not found for LTAPEDEV in pri srv01
> srv.srv01.out:ERR: Found 127.0.0.1 on TSM Server in resolv.conf for
> TSM srv01
> srv.srv02.out:ERR: dummy not found for LTAPEDEV in pri srv02
> srv.srv02.out:ERR: directory /dummy not found on filesystem in pri
> srv02
> srv.srv02.out:ERR: directory /dummy not found on filesystem in bkp
> srv02
> srv.srv02.out:ERR: Found 127.0.0.1 on TSM Server in resolv.conf for
> TSM srv02
> srv.srv03.out:ERR: dummy not found for LTAPEDEV in pri srv03
> srv.srv03.out:ERR: directory /dummy not found on filesystem in pri
> srv03
> srv.srv03.out:ERR: directory /dummy not found on filesystem in bkp
> srv03
> srv.srv03.out:ERR: Found 127.0.0.1 on TSM Server in resolv.conf for
> TSM srv03


I'd just replace "ERR: " with the FILENAME followed by a tab:

awk 'sub(/ERR: /,FILENAME"\t")1' *.out > err.txt

then open err.txt with Excel as tab-separated text.

Ed.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com