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"

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?


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.