Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Posts
    11

    Unanswered: Alternative to uniq

    Hi,
    I need to delete lines from the file which are similar to the first line "ONLY". The file looks something like:

    Line 1 (to be compared with )
    Line 2
    Line 3
    Line 1 (to be deleted)
    Line 4
    Line 1 to be deleted)

    uniq compares all the lines and also requires sort ..something I dont need to use.

    Could someone let me know how to go about it

    Thanks

  2. #2
    Join Date
    Jan 2004
    Location
    Bordeaux, France
    Posts
    320
    You can do somthing like this :
    Code:
    awk 'NR==1 { first = $0; print } $0 != first' input_file
    Jean-Pierre.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •