0

I have 2 columns in an excel sheet. Column 1 has the name of the cell and the column 2 has its value set.How can I find print unique values of each cell of column to individually?

TEST DATA:

CellName       Value                     DesiredOutput
--------------------------------------------------------
MANU1035    7; 7; 1; 1; 4; 4                7;1;4
MANU1036    7; 7; 1; 1; 4; 4                7;1;4
MANU1037    7; 7; 1; 1; 4; 4                7;1;4
MANU1038    7; 7; 1; 1; 4; 4                7;1;4
MANU1039    7; 7; 1; 1; 4; 4                7;1;4
MANU104     1; 7; 18; 16                    1;7;18;16
MANU1040    7; 7; 1; 1; 4; 4                7;1;4
MANU1041    7; 7; 1; 1; 4; 4                7;1;4
MANU1042    7; 7; 1; 1; 4; 4                7;1;4

I would like to solve this inside a excel/csv sheet or using a bash script.

  • Please copy + paste your sample data as text - not images of text. Use the edit button to add it. – steeldriver Oct 25 '19 at 12:24
0

This can easily be done using awk arrays. Copy and paste your highlighted cells into a text file and then follow the example given in this link:

https://www.datafix.com.au/BASHing/2019-06-07.html

| improve this answer | |
  • I understood how to do this using the link above. But, how can I select the unique numbers from (7; 7; 4; 4; 1; 1) this to (7;4;1). – Manoj Kumar Oct 25 '19 at 11:32
  • echo "7; 7; 4; 4; 1; 1" | tr ";" " " | tr -s " " "\n" | sort -u | tr "\n" ";" | rev | cut -c 2- which gives you 7;4;1 – elmclose Oct 28 '19 at 7:27

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.