recentpopularlog in

kme : sort   6

scripting - Best way to simulate "group by" from bash? - Stack Overflow
sort | uniq -c

Also very useful:

US|A|1000|2000
US|B|1000|2000
...

awk 'BEGIN { FS=OFS=SUBSEP="|"}{arr[$1,$2]+=$3+$4 }END {for (i in arr) print i,arr[i]}' file

US|A|3000
US|B|3000
...

Sort was used to handle very large volumes of data (think the original AT&T's billing data) on machines with 128k (that's 131,072 bytes) of memory (PDP-11). When sort encounters more data than a preset limit (often tuned close to the size of the machine's main memory) it sorts the data it has read in main memory and writes it into a temporary file. It then repeats the action with the next chunks of data. Finally, it performs a merge sort on those intermediate files. This allows sort to work on data many times larger than the machine's main memory.
bash  awk  sort  textprocessing  solution 
january 2017 by kme

Copy this bookmark:





to read