Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Posts
    30

    Unanswered: uniq command help

    I have a textfile and i want to search for a duplicate line in that file and delete that duplicate line plus the next 5 lines after that.

    Can any one help?

    Thanks

  2. #2
    Join Date
    Aug 2004
    Location
    Rome, Italy
    Posts
    81
    hi,
    with uniq I don't think(if I am not wrong) it can be done what you want. I tryed it with awk and it worked. Try this:

    -----------------------------------------------------
    awk 'BEGIN{i=10}{if(prev==$0)i=1; if(i>7&&prev!="") print prev; prev=$0;i=i+1}' my_file.txt
    ----------------------------------------------------

    I hopes it works for you as well.
    bye,
    ducasio

Posting Permissions

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