0

I'm using a very simple command in order to sort a list of Operators:

cut -d',' -f11 be_sendsms.csv | sort | uniq -c

The output I'm getting is:

95 "BASE17BE"
530 "BASE18BE"
252 "ORANGE17BE"
820 "ORANGE18BE"
162 "PROXIMUS17BE"
482 "PROXIMUS18BE"

Is there a simple way to accumulate the value of 'BASE17BE' and 'BASE18BE' so that their total appears together under 'BASE', and do the same for Orange and Proximus?

orrp
  • 1

1 Answers1

0

We can redirect the output to a temp file and then apply the command given in this answer

awk -F ' ' '$2 ~ /BASE/ {sum += $1} END {print sum}' temp

yashC
  • 185