uniq the file content

Hi
I want to uniq the content of a file based on 4th field

a.txt

abcd,123,456,234,asd
defg,123,456,235,asd
abcd,123,456,234,asd,lkjl,ijk
ijkl,123,456,234,asd
defg,123,456,235,asd,dfg,klm

o/p will be like

abcd,123,456,234,asd
defg,123,456,235,asd
ijkl,123,456,234,asd

or

abcd,123,456,234,asd,lkjl,ijk
ijkl,123,456,234,asd
defg,123,456,235,asd,dfg,klm

pls help

To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags

```text
 and 
```

by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums

According to your question , if you need based on 4th field, then

output will be

ijkl,123,456,234,asd
defg,123,456,235,asd,dfg,klm

use this code:-

nawk '
!a[$1$4]++
' input_file

Best Regards

Pls add, -F",".

thanks panyam sorry I forget :-

nawk -F"," '
!a[$1$4]++
' input_file

Hi when i am giving this comman i m getting error like

nawk -F"," '!a[$1$4]++' test
a[: Event not found.