1

I have an excel file and column 10 has multiple values like below,

Designation Header
-----------------
Student
Teacher
Teacher
Organization Director
Organization Director
Organization Head
Student
Organization Head
Organization Director
Teacher

I am trying to get the unique values from this column and the number of rows corresponding to each unique value in an associative array.

Here is the command I am using to get the unique value and number of rows,

awk -F',' 'NR>1{print $10}' Sorted_File.csv | sort | uniq -c

This gives me output as below,

 2 Student
 3 Teacher
 3 Organization Director
 2 Organization Head

How do I save this output in an associative array i.e key-value pair?

Your Answer

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

Browse other questions tagged or ask your own question.