Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 12-31-2002, 12:27 AM   #1
Nat
Confirmed User
 
Join Date: Sep 2001
Posts: 553
program to merge 2 txt-files needed

I would need a simple program/script that can merge 2 txt-files into one. The way it should be done is that the first line from txt1.txt should be written into txt3.txt, then the first line from txt2.txt should be written at the end of the first line in txt3.txt, then the second line from txt1.txt and second line of txt2.txt should appear on line 2 in txt3.txt etc.

so when viewing txt3.txt it would look just like if i have created 2 tables on a webpage listing txt1.txt in the first one and txt2.txt in the second.

Am i making any sense? if so, please help me out if anyone have something to do this, Thanks!
Nat is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2002, 12:29 AM   #2
pornJester
Confirmed User
 
Join Date: Mar 2001
Location: Florida
Posts: 6,138
should be simple with a few unix commands, i forget what they are though ;(
__________________


FreshBucks | Webmaster Vault | GayAW
Trusted Names in Adult.
ICQ 9157.3698
pornJester is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2002, 12:30 AM   #3
Living For Today
Confirmed User
 
Join Date: Feb 2002
Location: Brisbane, Australia
Posts: 3,970
unix is simple. but you have to be a genius to understand its simplicity.
Living For Today is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2002, 12:35 AM   #4
Nat
Confirmed User
 
Join Date: Sep 2001
Posts: 553
I will be more than happy for the time being if i just know how to merge a couple of files in the way described
Nat is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2002, 12:37 AM   #5
pornJester
Confirmed User
 
Join Date: Mar 2001
Location: Florida
Posts: 6,138
ok, i remember now...

cat file1 file2 > file3

from a unix command line
__________________


FreshBucks | Webmaster Vault | GayAW
Trusted Names in Adult.
ICQ 9157.3698
pornJester is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2002, 12:40 AM   #6
MonkeyMan
So Fucking Banned
 
Join Date: Dec 2002
Location: New York.... Not the city... Up north further. Its about a six hour drive to the city from here. I don't like the city much. The air is not as clean, but they do have better strip clubs.
Posts: 1,026
well heres a simple little php script that would do it....
Echo it to the screen then just save as .TXT

PHP Code:
<?php 

$length 
= (APPROX FILE LENGTH)
$fa file("file1.txt");
$fb file("file2.txt");
for(
$x=0$x<$length$x++)
{
echo 
$fa[$x] . $fb[$x] ."\n";
}

?>

Last edited by MonkeyMan; 12-31-2002 at 12:45 AM..
MonkeyMan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2002, 12:41 AM   #7
p1mpdogg
Too lazy to set a custom title
 
Join Date: Nov 2002
Posts: 16,714
for i in $(ls file*)
do
cat $i >> nameofnewfile
done <enter>

then the compiled file will be nameofnewfile
__________________
A fast fortune is easy to earn! Just go with a winner!
p1mpdogg is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2002, 12:41 AM   #8
Nat
Confirmed User
 
Join Date: Sep 2001
Posts: 553
pornJester: nah, that will only add the files after eachother..

MonkeyMan: great! thx!
Nat is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2002, 12:43 AM   #9
MonkeyMan
So Fucking Banned
 
Join Date: Dec 2002
Location: New York.... Not the city... Up north further. Its about a six hour drive to the city from here. I don't like the city much. The air is not as clean, but they do have better strip clubs.
Posts: 1,026
Nat please recopy the code or replace $START with the number 0
I forgot to do that.
MonkeyMan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2002, 12:46 AM   #10
pornJester
Confirmed User
 
Join Date: Mar 2001
Location: Florida
Posts: 6,138
Quote:
Originally posted by Nat
pornJester: nah, that will only add the files after eachother..

MonkeyMan: great! thx!
ya, i had just breezed over what you typed and thought that's what you were looking for, now that i read it more carefully i see what you were trying to do. It's late, need sleep ;)
__________________


FreshBucks | Webmaster Vault | GayAW
Trusted Names in Adult.
ICQ 9157.3698
pornJester is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2002, 12:48 AM   #11
Nat
Confirmed User
 
Join Date: Sep 2001
Posts: 553
MonkeyMan: em, help?

Parse error: parse error in /home/html/index.php on line 5
Nat is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2002, 01:01 AM   #12
Nat
Confirmed User
 
Join Date: Sep 2001
Posts: 553
Quote:
Originally posted by p1mpdogg
for i in $(ls file*)
do
cat $i >> nameofnewfile
done <enter>

then the compiled file will be nameofnewfile
Yeah, but that will only add txt2.txt after txt1.txt, not side by side as i'm looking for...
Nat is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2002, 01:03 AM   #13
p1mpdogg
Too lazy to set a custom title
 
Join Date: Nov 2002
Posts: 16,714
Quote:
Originally posted by Nat


Yeah, but that will only add txt2.txt after txt1.txt, not side by side as i'm looking for...
or you can rename your files you want to merge with the same prefix like

imadaddy.txt
imadaddy2.txt
imadaddy3.txt
then do
im*
__________________
A fast fortune is easy to earn! Just go with a winner!
p1mpdogg is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2002, 01:08 AM   #14
Nat
Confirmed User
 
Join Date: Sep 2001
Posts: 553
im*? what command are you reffering to?
Nat is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2002, 01:10 AM   #15
p1mpdogg
Too lazy to set a custom title
 
Join Date: Nov 2002
Posts: 16,714
for i in $(ls im*)
do
cat $i >> nameofnewfile
done


this will combine all files that start with im into the 'nameofnewfile'
__________________
A fast fortune is easy to earn! Just go with a winner!
p1mpdogg is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2002, 01:16 AM   #16
MonkeyMan
So Fucking Banned
 
Join Date: Dec 2002
Location: New York.... Not the city... Up north further. Its about a six hour drive to the city from here. I don't like the city much. The air is not as clean, but they do have better strip clubs.
Posts: 1,026
Quote:
Originally posted by Nat
MonkeyMan: em, help?

Parse error: parse error in /home/html/index.php on line 5

ooops
on this line add the ;

$length = 1000;


and make shre you replace "(APPROX FILE LENGTH)"
with a number


you should have

PHP Code:
<?php 
$length 
1000;
$fa file("file1.txt");
$fb file("file2.txt");
for(
$x=0$x<$length$x++)
{
echo 
$fa[$x] . $fb[$x] ."\n";
}
?>
but if the files are longer than 1000 lines increase that number.

Last edited by MonkeyMan; 12-31-2002 at 01:19 AM..
MonkeyMan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2002, 01:17 AM   #17
Nat
Confirmed User
 
Join Date: Sep 2001
Posts: 553
yes, but it will just add txt2.txt to the end of txt1.txt, but i want them to be added on the same line, line for line... reread my first post for a better explanation...
Nat is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-31-2002, 01:23 AM   #18
Nat
Confirmed User
 
Join Date: Sep 2001
Posts: 553
Great! got it working...
thanks!
Nat is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.