UNIX question -- how to sort and remove duplicates?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TheFLY
    So Fucking Banned
    • Jan 2001
    • 11856

    #1

    UNIX question -- how to sort and remove duplicates?

    I have a huge file that's full of tons of duplicate lines -- I want to remove all the duplicate lines from the file.

    I did a "man sort" and I didn't see any option to remove/ignore duplicate lines --

    Anyone know how to do it? I'm sure it's easy...
  • nuclei
    old school fart
    • May 2001
    • 1015

    #2
    cat filename.txt|sort|uniq > newfilename.txt
    The next generation of SEO

    Comment

    • TheFLY
      So Fucking Banned
      • Jan 2001
      • 11856

      #3
      Awesome I did "info sort"

      I found it...

      "
      `-u'
      `--unique'
      Normally, output only the first of a sequence of lines that compare
      equal. For the `--check' (`-c') option, check that no pair of
      consecutive lines compares equal."

      Comment

      • TheFLY
        So Fucking Banned
        • Jan 2001
        • 11856

        #4
        Originally posted by nuclei
        cat filename.txt|sort|uniq > newfilename.txt
        Cool I like that better... I figured there was a way to pipe it instead of using -o filename

        Comment

        • DennisS
          Confirmed User
          • Jan 2002
          • 265

          #5
          uniq filename newfilename

          Comment

          • Big E
            Registered User
            • Mar 2002
            • 935

            #6
            sort < in.txt | uniq > out.txt

            Comment

            • Dreamman010
              Confirmed User
              • Jan 2002
              • 1081

              #7
              Originally posted by TheFLY
              I have a huge file that's full of tons of duplicate lines -- I want to remove all the duplicate lines from the file.

              I did a "man sort" and I didn't see any option to remove/ignore duplicate lines --

              Anyone know how to do it? I'm sure it's easy...

              Trying to remove all the duplicate emails from a spam list?

              J/k dude
              <a href="http://www2.famoushost.com/home.php" target="_blank"><b><FONT COLOR="FFFF00">www.FamousHost.com</font></b></a><br>Free Hosting With No Headers, Real FTP, <u>Get listed on the biggest TGP's with us!</u>

              Comment

              • DrGuile
                Confirmed User
                • Jan 2002
                • 2025

                #8
                Originally posted by Dreamman010



                Trying to remove all the duplicate emails from a spam list?

                J/k dude

                thats exactly what I was going to say ;p
                LiveBucks / Privatefeeds - Giving you money since 1999
                Up to 50% Commission!
                25% Webmaster Referal
                Powered by Gamma

                Comment

                • pr0
                  rockin tha trailerpark
                  • May 2001
                  • 23088

                  #9
                  you know there is some great spam list software out there that can handle multiple millions
                  __________
                  Loadedca$h - get sum! - Revengebucks - mmm rebills! - webair (gotz sErVrz)

                  Comment

                  • TheFLY
                    So Fucking Banned
                    • Jan 2001
                    • 11856

                    #10
                    If you want to know what I was really doing... I had some code for one of my scripts to periodically remove dead trades -- using a formula -- blah -- anyway the code was buggy and the result was lots of duplicate entries over the course of many months the script still worked fine but the database was getting full of useless records... basically I fixed my code -- but then I needed to repair the database by removing the duplicates...

                    Anyway thanks for the help... maybe some day I will try some kind of email marketing but so far I've been too lazy to do it...

                    Comment

                    Working...