[TriLUG] Awk question
Joseph Mack NA3T
jmack at wm7d.net
Tue Aug 7 16:05:13 EDT 2007
On Tue, 7 Aug 2007, Mark Freeze wrote:
> I need to summarize the balance for the groups of records that have
> the same LCode and Packet, place the summarized total on the balance
> field of the record containing the highest AccountNum, and output only
> that record for the group. (And single records...) That operation
> would make a file that looked like this:
>
> RXX - 0115 - 12345 - 15077 - 20.50
> RZA - 0115 - 12345 - 15077 - 35.00
> RET - 0117 - 54324 - 19700 - 284.72
> RAB - 0119 - 28033 - 21001 - 18.78
> BFR - 0110 - 78749 - 19720 - 114.23
>
> Any suggestions on how to do this with awk? Can it be done? Better
> and faster than Perl?
I do simple stuff with awk all the time. awk is fastest to
write for the simple stuff. Awk works on columns a line at a
time. If you need to save values between lines, awk doesn't
do this easily. The arrays etc found in perl etc are what
you need.
When you talk about fast, I assume you mean "fast to
implement". You don't really care how fast something like
this runs do you?
Joe
--
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!
More information about the TriLUG
mailing list