2017-12-30 71 views

答えて

2

あなたは次のことを試してみて、これがあなたを助けている場合、私に知らせてもらえ。

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

出力は以下の通りです。

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

EDIT:あまりにもここでの説明を追加します。

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

'-F、'を使って '$ 2'をチェックするだけでいいです。 –

関連する問題