2017-12-30 36 views

Antwort

2

Könnten Sie bitte versuchen Sie folgende und lassen Sie mich wissen, ob das Ihnen hilft.

awk -F'[",]' '!a[$5]++' Input_file 

Die Ausgabe wird wie folgt sein.

"3","6" 
"3","7" 
"4","9" 
"26","48" 

EDIT: Erklärung Hinzufügen auch hier.

awk -F'[",]' ' ##Setting field separator as " or , for every line of Input_file. 
!a[$5]++   ##creating an array named a whose index is $5(fifth field) and checking condition if 5th field is NOT present in array a, so when any 5th field comes in array a then increasing its count so next time it will not take any duplicates in it. Since awk works on condition and then action, since here no action is mentioned so by default print of current line will happen. 
' Input_file  ##Mentioning the Input_file here too. 
+6

Sie könnten einfach '-F,' verwenden und '$ 2' überprüfen. –

Verwandte Themen