Anyone know of a program that will take a text file and randomize the lines?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jace
    FBOP Class Of 2013
    • Jan 2004
    • 35562

    #1

    Anyone know of a program that will take a text file and randomize the lines?

    I have a huge list of urls, and I need them to be in random order...I have text pad, but that only sorts by letter and shit, and I need everything to randomize

    is randomize even a word?
  • Quickdraw
    Confirmed User
    • Mar 2004
    • 1717

    #2
    If you can use PHP, here is quick dirty way to do it

    PHP Code:
    <?php
    $file = file("urls.txt");
    
    // Strips dupes if you need, comment out if you do not need this
    $temp = array_unique($file);
    
    //Shuffles the deck or randomizes :)
    shuffle($temp);
    //Prints each line 
    foreach($temp as $value)
       {
       echo $value;
       }
    exit;
    ?>

    Comment

    • BIGTYMER
      Junior Achiever
      • Nov 2004
      • 17066

      #3
      Originally posted by Quickdraw
      If you can use PHP, here is quick dirty way to do it

      PHP Code:
      <?php
      $file = file("urls.txt");
      
      // Strips dupes if you need, comment out if you do not need this
      $temp = array_unique($file);
      
      //Shuffles the deck or randomizes :)
      shuffle($temp);
      //Prints each line 
      foreach($temp as $value)
         {
         echo $value;
         }
      exit;
      ?>
      Cool little script. Thanks!

      Comment

      • StickyGreen
        .
        • Oct 2003
        • 13076

        #4
        gracias...
        Refer Cam Girls and Take Home 10% of Everything They Make For Life

        Comment

        • Jace
          FBOP Class Of 2013
          • Jan 2004
          • 35562

          #5
          Originally posted by Quickdraw
          If you can use PHP, here is quick dirty way to do it

          PHP Code:
          <?php
          $file = file("urls.txt");
          
          // Strips dupes if you need, comment out if you do not need this
          $temp = array_unique($file);
          
          //Shuffles the deck or randomizes :)
          shuffle($temp);
          //Prints each line 
          foreach($temp as $value)
             {
             echo $value;
             }
          exit;
          ?>
          i did that and it output everything as one single line...LOL

          worked great from what I can tell, but here is what it did


          http://www.constantbabes.com/tmp/urls.php

          Comment

          • mikeyddddd
            Viva la vulva!
            • Mar 2003
            • 16557

            #6
            Put a <br> on each line or change the script

            From this:

            echo $value;

            to this:

            echo "<br>$value";

            or echo "$value<br>";

            Comment

            • Quickdraw
              Confirmed User
              • Mar 2004
              • 1717

              #7
              Originally posted by Jace
              i did that and it output everything as one single line...LOL

              worked great from what I can tell, but here is what it did


              http://www.constantbabes.com/tmp/urls.php
              oh sorry--
              You can save that page as a text file, or view source and it will be line by line

              Comment

              • Jace
                FBOP Class Of 2013
                • Jan 2004
                • 35562

                #8
                Originally posted by mikeyddddd
                Put a <br> on each line or change the script

                From this:

                echo $value;

                to this:

                echo "<br>$value";

                or echo "$value<br>";
                PERFECT!

                Comment

                • Jace
                  FBOP Class Of 2013
                  • Jan 2004
                  • 35562

                  #9
                  Originally posted by Quickdraw
                  oh sorry--
                  You can save that page as a text file, or view source and it will be line by line
                  I just added a BR to the end of each line and it worked fine

                  didn't think of saving it

                  regardless, it worked perfect

                  Comment

                  • Quickdraw
                    Confirmed User
                    • Mar 2004
                    • 1717

                    #10
                    Cool, glad it did what you needed.
                    And yes, randomizes is a real word.
                    http://www.thefreedictionary.com/randomize

                    Comment

                    • potter
                      Confirmed User
                      • Dec 2004
                      • 6559

                      #11
                      You can also use open office. Paste all the items into a spreadsheet, then paste the random number char code into the column next to the urls, then sort by numbered column, copy the column with the urls and you're done.

                      Comment

                      Working...