I have the following file

1928282,Stephen LTD,31280938,L34
3128398,Stephen LTD,84327489,L34

I want to uniq on fields 2 & 4, the fields are comma seperated

I cant figure out how to do this....any ideas? im pretty sure uniq does not support this

Use nawk or /usr/xpg4/bin/awk on Solaris.

awk -F, '!x[$2,$4]++'  input

You can also use the -u flag to sort, which can pick out fields:

sort -t, -u -k2,2 -k4,4

Best wishes,

Mike

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.