duplicate lines without uniq command

Discussion in 'Programming/Scripts' started by w01verine, Aug 5, 2009.

  1. w01verine

    w01verine New Member

    Hello,
    Could you please tell me how to remove duplicate lines from a file without using uniq command?

    12-29-08 10:10 121221 server A
    12-29-08 10:12 121221 server A
    12-29-08 10:10 121221 server c
    12-29-08 10:10 121221 server B
    12-29-08 10:10 121221 server c
    12-29-08 10:12 121221 server A
    12-29-08 10:10 121221 server c
    12-29-08 10:10 121221 server B
    12-29-08 10:10 121221 server c

    This is an example file.

    Thanks in advance.
     
  2. Mosquito

    Mosquito New Member

    Just curious, why can't you use uniq?

    First thing you need to do is sort the file. That will make it much easier for you.
     
  3. w01verine

    w01verine New Member

    Hi Mosquito

    Thank you for posting :)

    nothing in particular.. I got an alternate way for this..

    sort -u filename

    This is working as expected for me..
     

Share This Page