Go Back   CodingForums.com > Web Projects and Services Marketplace > Web Projects > Small projects (quick fixes and changes)

Notices

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-20-2012, 01:40 AM   PM User | #1
JobNeedsDone
New to the CF scene

 
Join Date: May 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
JobNeedsDone can only hope to improve
Need script - Will pay!

Hi guys,

I've came to a problem, I have my members details in two .txt files.

1.txt and 2.txt

1.txt containing there name and 2.txt containing there address.

Each line in the txt file ends with there 13 digit membership number.

So what I've been doing is copying the membership number from 1.txt and searching 2.txt to match the name to the correct address.

I need some sort of script in which i can paste all membership numbers 1 per line and combine the lines together. For example:

I list the membership numbers.
I load 1.txt and 2.txt

123456789 being the first membership number to process.

Joe Soap 123456789 is found in 1.txt
11 Bubble Bath Lane 12356789 is found in 2.txt

Output.txt -> Joe Soap 123456789 11 Bubble Bath Lane 12356789


If anyone has the idea of what i need done here and your capable of doing it, im willing to pay for this sort of script.

It doesnt need to be in PHP

I can't do this manually since there is thousands.

Please reply with your skype/msn/messenger if you can do this we will talk about a price.
JobNeedsDone is offline   Reply With Quote
Old 05-20-2012, 03:35 AM   PM User | #2
jmj001
Regular Coder

 
Join Date: Jan 2012
Posts: 271
Thanks: 2
Thanked 65 Times in 65 Posts
jmj001 is an unknown quantity at this point
I've got a deal for you...

Paste a 3 line extract from both the files in here and I'll write you a script to do it and paste in in here for you.

Once you have the script and tested it and extracted all your data you can pay me $5

How's that?
jmj001 is offline   Reply With Quote
Old 05-20-2012, 04:36 AM   PM User | #3
JobNeedsDone
New to the CF scene

 
Join Date: May 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
JobNeedsDone can only hope to improve
"id","members name","access code","expiration","pin","173920"
"id","members name","access code","expiration","pin","628419"
"id","members name","access code","expiration","pin","704241"

"address","city","state","","zip","077315"
"address","city","state","","zip","238403"
"address","city","state","","zip","222709"

I have edited out confidential information and replaced with field names..
As you can see the end numbers are the membership numbers, both files contain those at the end of each line, i need the ones that match to be combined/merged into one line and put into an output file

So it would come out like this:

"id","members name","access code","expiration","pin","704241" "address","city","state","","zip","704241"



If you can do the script i require, I'll pay you 25x $5

Last edited by JobNeedsDone; 05-20-2012 at 04:40 AM..
JobNeedsDone is offline   Reply With Quote
Old 05-20-2012, 07:09 AM   PM User | #4
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,292
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
I can do this for you. I have sent you a PM. What do you want to happen if there isn't a match?
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 05-20-2012, 11:37 AM   PM User | #5
jmj001
Regular Coder

 
Join Date: Jan 2012
Posts: 271
Thanks: 2
Thanked 65 Times in 65 Posts
jmj001 is an unknown quantity at this point
@jobsneedsdone - just got back and starting on this for you now. Will post the code here for you within 30 minutes.....
jmj001 is offline   Reply With Quote
Old 05-20-2012, 12:22 PM   PM User | #6
jmj001
Regular Coder

 
Join Date: Jan 2012
Posts: 271
Thanks: 2
Thanked 65 Times in 65 Posts
jmj001 is an unknown quantity at this point
OK, this script below should do the job that is assuming the following:

1 - the files with content are exactly as you have describe with no other header lines or anything out of place
2 - the file are readable and in the same drectory as this script
3 - you hold your mouth at just the right angle when pushing the button

anyway... this is a first test... let me know how it goes.

PHP Code:
<?php
/*
put this script in the same directory as the two files and put the file names in below.
*/
// enter the file names here
$file1 'file-1.txt';
$file2 'file-2.txt';

$data1 filetoarray($file1,6);   // you can actually specify the column the id is in if it's different in each file... although it seems to be the same from your dataset extract... at column 6
$data2 filetoarray($file2,6);

// now loop through one of the datasets and match the keys with the other
// build the keys list
$dataSetKeys array_keys($data1);
// loop through the keys and build the results
$j count($dataSetKeys);
for(
$i 0$i $j$i++){
    
$thisKey $dataSetKeys[$i];
    if(isset(
$data2[$thisKey])){
        echo 
$data1[$thisKey][0].','.$data1[$thisKey][1].','.$data1[$thisKey][2].','.$data1[$thisKey][3].','.$data1[$thisKey][4].','.$data1[$thisKey][5].','.$data2[$thisKey][0].','.$data2[$thisKey][1].','.$data2[$thisKey][2].','.$data2[$thisKey][3].','.$data2[$thisKey][4].','.$data2[$thisKey][5]."<br>";
    }
}
// "id","members name","access code","expiration","pin","704241" "address","city","state","","zip","704241"



// functions...
function filetoarray($file,$idKeyCol){
    
$rawData1 file_get_contents($file);
    return 
cleanlines($rawData1,$idKeyCol);
}

function 
cleanlines($data,$idKeyCol){
    
// expand it at the linebreaks
    
$newData explode("\n",$data);
    
$cleanData = array();
    
$j count($newData);
    for(
$i 0$i $j$i++){
        
$thisParts explode(",",$newData[$i]);
        
$cleanData[$thisParts[$idKeyCol-1]] = $thisParts;
    }
    return 
$cleanData;
}
?>

Last edited by jmj001; 05-20-2012 at 12:24 PM..
jmj001 is offline   Reply With Quote
Old 05-20-2012, 06:52 PM   PM User | #7
JobNeedsDone
New to the CF scene

 
Join Date: May 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
JobNeedsDone can only hope to improve
Hey,

Thanks Jim, so im guessing i upload this to an ftp with my 2 files and run the script, after chmod'ing them correctly? thanks.
JobNeedsDone is offline   Reply With Quote
Old 05-20-2012, 07:01 PM   PM User | #8
JobNeedsDone
New to the CF scene

 
Join Date: May 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
JobNeedsDone can only hope to improve
You sir are a genious, send me a PM and i will get you paid.
JobNeedsDone is offline   Reply With Quote
Old 05-20-2012, 08:40 PM   PM User | #9
jmj001
Regular Coder

 
Join Date: Jan 2012
Posts: 271
Thanks: 2
Thanked 65 Times in 65 Posts
jmj001 is an unknown quantity at this point
PM sent... I'm guessing it worked as required then?

Cheers...
jmj001 is offline   Reply With Quote
Old 05-20-2012, 10:29 PM   PM User | #10
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,292
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Good luck trying to get paid. They can only use their bank, paysafe, skype minutes, or western union (eventually).
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 05-21-2012, 01:29 AM   PM User | #11
jmj001
Regular Coder

 
Join Date: Jan 2012
Posts: 271
Thanks: 2
Thanked 65 Times in 65 Posts
jmj001 is an unknown quantity at this point
I guess we'll find out if he's an honest man...
jmj001 is offline   Reply With Quote
Old 05-22-2012, 05:07 AM   PM User | #12
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,292
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Let us know how it works out.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 05-22-2012, 07:22 AM   PM User | #13
jmj001
Regular Coder

 
Join Date: Jan 2012
Posts: 271
Thanks: 2
Thanked 65 Times in 65 Posts
jmj001 is an unknown quantity at this point
as expected.. no word from the OP for more than 24 hours now.. we'll see but it's looking like a non payment at this stage...
jmj001 is offline   Reply With Quote
Old 05-24-2012, 05:24 AM   PM User | #14
Puppet Master
New Coder

 
Join Date: Nov 2010
Location: California
Posts: 42
Thanks: 6
Thanked 2 Times in 2 Posts
Puppet Master is an unknown quantity at this point
So did the OP pay you yet?

PayPal is always an option...
__________________
Puppet Master + Programming = Eternal Bliss
Puppet Master is offline   Reply With Quote
Old 05-24-2012, 11:21 AM   PM User | #15
jmj001
Regular Coder

 
Join Date: Jan 2012
Posts: 271
Thanks: 2
Thanked 65 Times in 65 Posts
jmj001 is an unknown quantity at this point
Nope, had no word from him for a couple of days now... he won't pay now, the little weasel got his code.
__________________
hey... it's a sig..
jmj001 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:33 AM.


Advertisement
Log in to turn off these ads.