I'm relatively new to the UNIX world (I've been lost in the Microsofa world!) and I haven't used awk yet, but I think it would be useful in grouping and aggregating data. I'm not sure how to proceed, and would welcome any suggestions.
I have three fields in a delimited file. The file is sorted by a business id, then by the an item id, and then the third field is a quantity. What I would like to do is aggregate the quantity by the business id. I was told that awk would be a very useful tool to do this, but I'm not really sure how to proceed.
My script extracts data from various flat files (all fixed-string) and formats & sorts the files, but this is the last step and I'm not sure how to proceed.
Thanks in advance for any assistance you can provide.
If the line is 'blank' - your output will not change as there's no $1 and the value of $NF is '0' which does not change the value of the 'sum' [if there was one]
It's better to use 'FNR > 1' as you may have multiple input files with headers
I want to thank all of you. Just being new to the world of awk, I really appreciate all of the help. This has pointed me in the right direction, and I should be able to wrap this up today. May every lotto ticket you buy be a winning one!