Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore case when removing duplicates using awk

Tags:

unix

awk

I am using following command to remove duplicates from file.

awk -F"," '!x[$1]++' test.csv

How can I make it to ignore case of column 1?

I tried awk -F"," '{IGNORECASE = 1} !x[$1]++' test.csv but it does not seem to work.

like image 365
RandomQuestion Avatar asked Dec 26 '22 12:12

RandomQuestion


1 Answers

Using toupper:

awk -F"," '!x[toupper($1)]++' test.csv
like image 64
perreal Avatar answered Dec 31 '22 12:12

perreal