[ILUG] Re: perl file processing

Marcus Furlong furlongm at hotmail.com
Wed Oct 8 19:50:04 IST 2008


Francis Daly <francisdaly <at> gmail.com> writes:

[Message truncated to please the gmane web interface]

> If my description above is reasonable, then feeding the file through
> something like
> 
> sed '1,/Stratified cross-validation/d' | sed '1,/Detailed Accuracy By
> Class/d' | sed -e '1,2d' -e '/^$/,$d'
> 
> would be one way of only getting that table you want.
> 
> Sending that through
> 
> awk 'END{print a/NR, b/NR, c/NR, d/NR, e/NR, f/NR} {a+=$1; b+=$2;
> c+=$3; d+=$4; e+=$5; f+=$6}'
> 
> (Not pretty, but effective) will spit out the arithmetic mean of the
> exact numbers logged. You can tweak it to report only appropriate
> significant figures, if needed.
> 
> The processing is fragile because of the assumptions made. But if the
> file format matches, you're sorted.

The assumptions you made were correct.

> 
> If you really want, you could a2p or s2p those to turn them into perl.
> 
> Hope this pushes you in the right direction,

Super, thanks a million! This works perfectly on all the files I've
tested so far.

Marcus.




More information about the ILUG mailing list