<p>Close but you ignited the math in the requirements.</p>
<p>Here us the answer:<br>
awk '{prev=last; last=$2} END {print (last-prev)/prev}' filename </p>
<p>This is untested because I wrote it on a phone.</p>
<p>On Feb 3, 2012 4:26 PM, "Erik Mathis" <<a href="mailto:erik@mathists.com">erik@mathists.com</a>> wrote:<br>
><br>
> awk '{sum+=$2} END {print sum}' filename<br>
> 310<br>
> awk '{subt-=$2} END {print subt}' filename<br>
> -310<br>
><br>
> Stolen and hacked from <a href="http://www.commandlinefu.com">http://www.commandlinefu.com</a><br>
><br>
> -Erik-<br>
><br>
> On Fri, Feb 3, 2012 at 1:51 PM, Randy Ramsdell <<a href="mailto:rramsdell@activedg.com">rramsdell@activedg.com</a>> wrote:<br>
> > I need to parse a file and then subtract next to last line field $2<br>
> > from the last line field $2 using awk and then convert this number to a<br>
> > percent.<br>
> ><br>
> > Data:<br>
> ><br>
> > $date 100<br>
> > $date 103<br>
> > $date 107<br>
> ><br>
> > So ... ( 107 - 103 ) / 103 ...<br>
> ><br>
> > Clues?<br>
> > _______________________________________________<br>
> > Ale mailing list<br>
> > <a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
> > <a href="http://mail.ale.org/mailman/listinfo/ale">http://mail.ale.org/mailman/listinfo/ale</a><br>
> > See JOBS, ANNOUNCE and SCHOOLS lists at<br>
> > <a href="http://mail.ale.org/mailman/listinfo">http://mail.ale.org/mailman/listinfo</a><br>
> _______________________________________________<br>
> Ale mailing list<br>
> <a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
> <a href="http://mail.ale.org/mailman/listinfo/ale">http://mail.ale.org/mailman/listinfo/ale</a><br>
> See JOBS, ANNOUNCE and SCHOOLS lists at<br>
> <a href="http://mail.ale.org/mailman/listinfo">http://mail.ale.org/mailman/listinfo</a><br>
</p>