GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   text duplicator?? help (https://gfy.com/showthread.php?t=814177)

xxweekxx 03-11-2008 02:38 AM

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

xxweekxx 03-11-2008 09:41 AM

bump......

wizzart 03-11-2008 10:29 AM

PHP code

xxweekxx 03-11-2008 11:04 AM

KNow of any?

Fap 03-11-2008 11:05 AM

copy and paste 10,000x

xxweekxx 03-11-2008 11:33 AM

bump.. come on

xxweekxx 03-11-2008 12:01 PM

no program out there does this?

xxweekxx 03-11-2008 01:43 PM

bump again..thanks

wizzart 03-11-2008 01:45 PM

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++;
}
?>


xxweekxx 03-11-2008 09:12 PM

bump again

xxweekxx 03-11-2008 10:26 PM

Hey Bump People

MichaelP 03-11-2008 10:52 PM

Quote:

Originally Posted by wizzart (Post 13906781)
PHP Code:

<?
$a="Some text";
$b="Second Text";
$i=0;
while ($i<10000){
echo "$a";
echo "$b";
$i++;
}
?>


exactly :thumbsup

xxweekxx 03-11-2008 10:55 PM

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..

xxweekxx 03-12-2008 01:20 AM

Ill pay someone to code this for me!

wizzart 03-12-2008 03:05 AM

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

wizzart 03-12-2008 03:10 AM

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++; 

?>


xxweekxx 03-12-2008 05:23 AM

wizzart how do i run this??

wizzart 03-12-2008 05:36 AM

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. ;)

xxweekxx 03-12-2008 05:43 AM

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

xxweekxx 03-12-2008 05:45 AM

im probably asking for me too much but can this possible report the results in text file?

xxweekxx 03-12-2008 06:16 AM

bump! can anyone help fix this errro

wizzart 03-12-2008 07:33 AM

Quote:

Originally Posted by xxweekxx (Post 13909425)
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++;  
}  
?>


wizzart 03-12-2008 07:47 AM

Quote:

Originally Posted by xxweekxx (Post 13909438)
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?

xxweekxx 03-12-2008 04:32 PM

error with that last script.. it doesnt work, it just reports one LINE, and in source code all i say is <br />

xxweekxx 03-12-2008 04:49 PM

nobody can fix this? ill pay

xxweekxx 03-12-2008 04:56 PM

bump again :( :(

rowan 03-12-2008 05:21 PM

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)

Tempest 03-12-2008 06:08 PM

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?

Tempest 03-12-2008 06:12 PM

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

Swish 03-12-2008 06:16 PM

Quote:

Originally Posted by rowan (Post 13913522)
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 :thumbsup

woj 03-12-2008 06:22 PM

hit me up, icq: 33385924 I'll hook it up for you for a few bucks...

Swish 03-12-2008 06:23 PM

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

brandonstills 03-12-2008 06:54 PM

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.

xxweekxx 03-13-2008 12:16 AM

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

xxweekxx 03-13-2008 12:16 AM

Quote:

Originally Posted by brandonstills (Post 13913895)
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 :helpme

wizzart 03-13-2008 08:03 AM

Quote:

Originally Posted by Swish (Post 13913763)
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:


All times are GMT -7. The time now is 01:38 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123