On 06/04/2013 01:07 PM, Shahid Hussain wrote:
> I have a file (named 'a')which contains following data.
> "";
> 8003
> 8004
> 8005
> 8010
> 9040
> 9041
> 9042
> 8336
> 8336
> 8337
> 8338
> 8338
> 8339
> 8340
> 8341
> 9000
> 9216
> 9217
> 9218
> 9219
> 9220
> 9221
> 9232
> 9233
> 9234
> 9248
> 9249
> 9250
> 9251
> 9264
> 9265
> 9280
> 9296
> 9281
> 9297
> 9001
> 9226
> 9040
> 9040
> 15008
> 9041
> 9042
> 15009
> 15010
> 6169
> 6170
> 18000
> 18000
> 
> *************************************************
> And Below is the commands i am executing along with its output with
> comments.
> [ussc@lab211 config]$ uniq -d a
> 8336
> 8338
> //Displaying one duplicate entry But so many duplicate entries are there in
> file
> [ussc@lab211 config]$ uniq -D a
> 8336
> 8336
> 8338
> 8338
> //Displaying only two duplicate entry But so many duplicate entries are
> there in file
> [ussc@lab211 config]$ uniq -c a
>       1 "";
>       1 8003
>       1 8004
>       1 8005
>       1 8010
>       1 9040
>       1 9041
>       1 9042
>       2 8336
>       1 8337
>       2 8338
>       1 8339
>       1 8340
>       1 8341
>       1 9000
>       1 9216
>       1 9217
>       1 9218
>       1 9219
>       1 9220
>       1 9221
>       1 9232
>       1 9233
>       1 9234
>       1 9248
>       1 9249
>       1 9250
>       1 9251
>       1 9264
>       1 9265
>       1 9280
>       1 9296
>       1 9281
>       1 9297
>       1 9001
>       1 9226
>       1 9040
>       1 9040
>       1 15008
>       1 9041
>       1 9042
>       1 15009
>       1 15010
>       1 6169
>       1 6170
>       1 18000
>       1 18000
> //Observe last line which is repeated with its previous line (some other
> entries are also there)but uniq command not able to find it.
> 
> 
> 
> Please check it once and let me know if i am wrong.
> Thanks and Regards,
> Shahid Hussain
> Bangalore.
> 
> 

Note 9041 is also repeated but you won't see that
until you sort first, though that's not your specific issue here.

Perhaps you have mixed \n and \r\n line endings or something?
This might be informative?

tail -n2 a | od -Ax -tx1z -v

thanks,
Pádraig.



Reply via email to