text duplicator?? help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xxweekxx
    Confirmed User
    • Oct 2002
    • 6780

    #1

    text duplicator?? help

    hey guys,

    Say u have a text file with lines:

    a
    b
    c
    d
    e
    f
    g
    h

    are there any programs that can duplicate this, say 10,000 times, so now ull have 10000 a's, 10k b's, 10k c's, etc.

    thanks
    _________________
    I am the best
  • xxweekxx
    Confirmed User
    • Oct 2002
    • 6780

    #2
    bump......
    _________________
    I am the best

    Comment

    • wizzart
      scriptmaster
      • May 2006
      • 5246

      #3
      PHP code
      BimboZone

      Comment

      • xxweekxx
        Confirmed User
        • Oct 2002
        • 6780

        #4
        KNow of any?
        _________________
        I am the best

        Comment

        • Fap
          Just Du It
          • Feb 2004
          • 12094

          #5
          copy and paste 10,000x

          Comment

          • xxweekxx
            Confirmed User
            • Oct 2002
            • 6780

            #6
            bump.. come on
            _________________
            I am the best

            Comment

            • xxweekxx
              Confirmed User
              • Oct 2002
              • 6780

              #7
              no program out there does this?
              _________________
              I am the best

              Comment

              • xxweekxx
                Confirmed User
                • Oct 2002
                • 6780

                #8
                bump again..thanks
                _________________
                I am the best

                Comment

                • wizzart
                  scriptmaster
                  • May 2006
                  • 5246

                  #9
                  PHP Code:
                  <?
                  $a="Some text";
                  $i=0;
                  while ($i<10000){
                  echo "$a";
                  $i++;
                  }
                  ?>
                  PHP Code:
                  <?
                  $a="Some text";
                  $b="Second Text";
                  $i=0;
                  while ($i<10000){
                  echo "$a";
                  echo "$b";
                  $i++;
                  }
                  ?>
                  BimboZone

                  Comment

                  • xxweekxx
                    Confirmed User
                    • Oct 2002
                    • 6780

                    #10
                    bump again
                    _________________
                    I am the best

                    Comment

                    • xxweekxx
                      Confirmed User
                      • Oct 2002
                      • 6780

                      #11
                      Hey Bump People
                      _________________
                      I am the best

                      Comment

                      • MichaelP
                        Registered User
                        • Aug 2003
                        • 7123

                        #12
                        Originally posted by wizzart
                        PHP Code:
                        <?
                        $a="Some text";
                        $b="Second Text";
                        $i=0;
                        while ($i<10000){
                        echo "$a";
                        echo "$b";
                        $i++;
                        }
                        ?>
                        exactly

                        Comment

                        • xxweekxx
                          Confirmed User
                          • Oct 2002
                          • 6780

                          #13
                          that code has a lil problem.. my original file has 1,000 lines, and i wanna dupilicate it to X1000

                          How will that code work if your original text file is 1000 lines? I need code that can read from text file..
                          _________________
                          I am the best

                          Comment

                          • xxweekxx
                            Confirmed User
                            • Oct 2002
                            • 6780

                            #14
                            Ill pay someone to code this for me!
                            _________________
                            I am the best

                            Comment

                            • wizzart
                              scriptmaster
                              • May 2006
                              • 5246

                              #15
                              PHP Code:
                              <? 
                              $fp = @fopen("txtfile.txt", "rb") or die("Couldn't open txt file"); 
                              $data = @fread($fp, @filesize($fp)); 
                              while(!feof($fp)) 
                              { 
                              $data .= @fgets($fp, 409600); 
                              } 
                              
                              fclose($fp); 
                              
                              $i=1; 
                              
                              while ($i<10000)
                              { 
                              $text = explode("\n", $data);
                              echo " $text[$i] ";
                              $i++; 
                              } 
                              ?>
                              Just change in first line txtfile.txt to your txt file
                              Last edited by wizzart; 03-12-2008, 02:06 AM.
                              BimboZone

                              Comment

                              • wizzart
                                scriptmaster
                                • May 2006
                                • 5246

                                #16
                                Sorry

                                Sorry not that code , this is what you need

                                PHP Code:
                                <? 
                                $fp = @fopen("txtfile.txt", "rb") or die("Couldn't open txt file"); 
                                $data = @fread($fp, @filesize($fp)); 
                                while(!feof($fp)) 
                                { 
                                $data .= @fgets($fp, 409600); 
                                } 
                                
                                fclose($fp); 
                                $i=1; 
                                
                                while ($i<10000){ 
                                echo " $data ";
                                $i++; 
                                } 
                                ?>
                                BimboZone

                                Comment

                                • xxweekxx
                                  Confirmed User
                                  • Oct 2002
                                  • 6780

                                  #17
                                  wizzart how do i run this??
                                  _________________
                                  I am the best

                                  Comment

                                  • wizzart
                                    scriptmaster
                                    • May 2006
                                    • 5246

                                    #18
                                    Open you HTML editor and paste this last code and save file as test.php
                                    Open notepad write some text and save file as txtfile.txt

                                    Upload that 2 files to your server and go to http://yoursite.com/test.php and you will see result. ;)
                                    BimboZone

                                    Comment

                                    • xxweekxx
                                      Confirmed User
                                      • Oct 2002
                                      • 6780

                                      #19
                                      script works ok bro.. except it doesnt line break..

                                      Example i put in

                                      a
                                      b

                                      it returns text file as
                                      a b
                                      a b

                                      instead of
                                      a
                                      b
                                      a
                                      b
                                      Last edited by xxweekxx; 03-12-2008, 04:43 AM. Reason: aa
                                      _________________
                                      I am the best

                                      Comment

                                      • xxweekxx
                                        Confirmed User
                                        • Oct 2002
                                        • 6780

                                        #20
                                        im probably asking for me too much but can this possible report the results in text file?
                                        _________________
                                        I am the best

                                        Comment

                                        • xxweekxx
                                          Confirmed User
                                          • Oct 2002
                                          • 6780

                                          #21
                                          bump! can anyone help fix this errro
                                          _________________
                                          I am the best

                                          Comment

                                          • wizzart
                                            scriptmaster
                                            • May 2006
                                            • 5246

                                            #22
                                            Originally posted by xxweekxx
                                            script works ok bro.. except it doesnt line break..

                                            Example i put in

                                            a
                                            b

                                            it returns text file as
                                            a b
                                            a b

                                            instead of
                                            a
                                            b
                                            a
                                            b
                                            For that do this

                                            PHP Code:
                                            <?  
                                            $fp = @fopen("txtfile.txt", "rb") or die("Couldn't open txt file");  
                                            $data = @fread($fp, @filesize($fp));  
                                            while(!feof($fp))  
                                            {  
                                            $data .= @fgets($fp, 409600);  
                                            }  
                                            
                                            fclose($fp);  
                                            
                                            $i=1;  
                                            
                                            while ($i<10000) 
                                            {  
                                            $text = explode("\n", $data); 
                                            $write = " $text[$i]<br /> "; 
                                            echo "$write";
                                            $i++;  
                                            }  
                                            ?>
                                            BimboZone

                                            Comment

                                            • wizzart
                                              scriptmaster
                                              • May 2006
                                              • 5246

                                              #23
                                              Originally posted by xxweekxx
                                              im probably asking for me too much but can this possible report the results in text file?
                                              Yes it's posible but how much you are ready to pay for that?
                                              BimboZone

                                              Comment

                                              • xxweekxx
                                                Confirmed User
                                                • Oct 2002
                                                • 6780

                                                #24
                                                error with that last script.. it doesnt work, it just reports one LINE, and in source code all i say is <br />
                                                Last edited by xxweekxx; 03-12-2008, 03:35 PM.
                                                _________________
                                                I am the best

                                                Comment

                                                • xxweekxx
                                                  Confirmed User
                                                  • Oct 2002
                                                  • 6780

                                                  #25
                                                  nobody can fix this? ill pay
                                                  _________________
                                                  I am the best

                                                  Comment

                                                  • xxweekxx
                                                    Confirmed User
                                                    • Oct 2002
                                                    • 6780

                                                    #26
                                                    bump again
                                                    _________________
                                                    I am the best

                                                    Comment

                                                    • rowan
                                                      Too lazy to set a custom title
                                                      • Mar 2002
                                                      • 17393

                                                      #27
                                                      Got a dedicated server with ssh login? Create the following script and run it with "sh <scriptname>"

                                                      Code:
                                                      cp /dev/null output.txt
                                                      for x in 0 1 2 3 4 5 6 7 8 9
                                                      do
                                                        for y in 0 1 2 3 4 5 6 7 8 9
                                                        do
                                                          for z in 0 1 2 3 4 5 6 7 8 9
                                                          do
                                                            cat input.txt >> output.txt
                                                          done
                                                        done
                                                      done
                                                      This will append input.txt to output.txt 1,000 times

                                                      (There's probably a better way to loop 1,000 times but I'm too lazy to figure it out)

                                                      Comment

                                                      • Tempest
                                                        Too lazy to set a custom title
                                                        • May 2004
                                                        • 10217

                                                        #28
                                                        Can you clarify what you want...

                                                        you have the following

                                                        a
                                                        b
                                                        c
                                                        d

                                                        and you want 1000 lines of:
                                                        a b c d

                                                        Is that correct?

                                                        Comment

                                                        • Tempest
                                                          Too lazy to set a custom title
                                                          • May 2004
                                                          • 10217

                                                          #29
                                                          Also... Do you just need to do this once? have a standalone script to do this? replace a function in some existing code?

                                                          Comment

                                                          • Swish
                                                            Confirmed User
                                                            • Mar 2006
                                                            • 1421

                                                            #30
                                                            Originally posted by rowan
                                                            Got a dedicated server with ssh login? Create the following script and run it with "sh <scriptname>"

                                                            Code:
                                                            cp /dev/null output.txt
                                                            for x in 0 1 2 3 4 5 6 7 8 9
                                                            do
                                                              for y in 0 1 2 3 4 5 6 7 8 9
                                                              do
                                                                for z in 0 1 2 3 4 5 6 7 8 9
                                                                do
                                                                  cat input.txt >> output.txt
                                                                done
                                                              done
                                                            done
                                                            This will append input.txt to output.txt 1,000 times

                                                            (There's probably a better way to loop 1,000 times but I'm too lazy to figure it out)
                                                            Code:
                                                            for x in `seq 0 999`; do cat input.txt >> output.txt; done
                                                            All command line, no script file needed


                                                            Naughty America - Director of Technology
                                                            It's a CELEBRATION bitches!! For the hottest content promote Naughty America!
                                                            swish at naughtyamerica dot com | ICQ: 226 737 620 | See Who I Am At AdultWhosWho.com!

                                                            Comment

                                                            • woj
                                                              <&(©¿©)&>
                                                              • Jul 2002
                                                              • 47880

                                                              #31
                                                              hit me up, icq: 33385924 I'll hook it up for you for a few bucks...
                                                              Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
                                                              Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
                                                              Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

                                                              Comment

                                                              • Swish
                                                                Confirmed User
                                                                • Mar 2006
                                                                • 1421

                                                                #32
                                                                here's the php:

                                                                Code:
                                                                <?php
                                                                
                                                                $LINES = file("input.txt");
                                                                
                                                                $fp = fopen("output.txt", "w");
                                                                
                                                                for ( $i=0; $i<1000; $i++ ) {
                                                                    foreach ( $LINES as $LINE )
                                                                        fwrite($fp, "$LINE");
                                                                }
                                                                
                                                                fclose($fp);
                                                                
                                                                ?>
                                                                input.txt is the existing file and output.txt is the new file when complete, save the code as somefile.php upload to server along with input.txt load the somefile.php in your browser or execute on the command line and output.txt will be created
                                                                Last edited by Swish; 03-12-2008, 05:25 PM.


                                                                Naughty America - Director of Technology
                                                                It's a CELEBRATION bitches!! For the hottest content promote Naughty America!
                                                                swish at naughtyamerica dot com | ICQ: 226 737 620 | See Who I Am At AdultWhosWho.com!

                                                                Comment

                                                                • brandonstills
                                                                  Confirmed User
                                                                  • Dec 2007
                                                                  • 1964

                                                                  #33
                                                                  sed and awk are made for this kind of thing. don't even need a program, can do it on the command line.

                                                                  Hell, even vi can do that.

                                                                  Brandon Stills
                                                                  Industry and programming veteran
                                                                  [email protected] | skype: brandonstills | ICQ #495-171-318

                                                                  Comment

                                                                  • xxweekxx
                                                                    Confirmed User
                                                                    • Oct 2002
                                                                    • 6780

                                                                    #34
                                                                    eheh jesus nobody can get this right?

                                                                    your script worked with 2 lines..
                                                                    then i loaded 2000 lines to be duplicated 1000 times each, and it crapped out..

                                                                    Doesnt work.. this is getting ridiculous
                                                                    _________________
                                                                    I am the best

                                                                    Comment

                                                                    • xxweekxx
                                                                      Confirmed User
                                                                      • Oct 2002
                                                                      • 6780

                                                                      #35
                                                                      Originally posted by brandonstills
                                                                      sed and awk are made for this kind of thing. don't even need a program, can do it on the command line.

                                                                      Hell, even vi can do that.

                                                                      sed and awk and vi.. wow makes lot of sense.. i got no clue what u mean buddy
                                                                      _________________
                                                                      I am the best

                                                                      Comment

                                                                      • wizzart
                                                                        scriptmaster
                                                                        • May 2006
                                                                        • 5246

                                                                        #36
                                                                        Originally posted by Swish
                                                                        here's the php:

                                                                        Code:
                                                                        <?php
                                                                        
                                                                        $LINES = file("input.txt");
                                                                        
                                                                        $fp = fopen("output.txt", "w");
                                                                        
                                                                        for ( $i=0; $i<1000; $i++ ) {
                                                                            foreach ( $LINES as $LINE )
                                                                                fwrite($fp, "$LINE");
                                                                        }
                                                                        
                                                                        fclose($fp);
                                                                        
                                                                        ?>
                                                                        input.txt is the existing file and output.txt is the new file when complete, save the code as somefile.php upload to server along with input.txt load the somefile.php in your browser or execute on the command line and output.txt will be created
                                                                        That is very clean and nice code :cool:
                                                                        BimboZone

                                                                        Comment

                                                                        Working...