Go Back   CodingForums.com > :: Server side development > Perl/ CGI

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 04-26-2010, 11:29 AM   PM User | #1
rohith_sh
New to the CF scene

 
Join Date: Apr 2010
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
rohith_sh is an unknown quantity at this point
Angry Merge multiple hosts files

Hi,

I'm trying to upload multiple hosts files with different blockable entries
(%windir%\system32\drivers\etc\hosts) to a http server, and i want to merge these hosts file into one big hosts file periodically, like say, every 6 hours a day and produce a new file on the same server. My aim in merging these files is to remove duplicate entries and obviously, appending wouldnt work.

Is there any way i can do this with perl ? (or maybe with php, bcz m having second thoughts now )
rohith_sh is offline   Reply With Quote
Old 04-29-2010, 03:15 PM   PM User | #2
rohith_sh
New to the CF scene

 
Join Date: Apr 2010
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
rohith_sh is an unknown quantity at this point
Nothing yet guys?
rohith_sh is offline   Reply With Quote
Old 04-29-2010, 03:51 PM   PM User | #3
FishMonger
Super Moderator


 
Join Date: May 2005
Location: Southern tip of Silicon Valley
Posts: 2,753
Thanks: 2
Thanked 149 Times in 144 Posts
FishMonger will become famous soon enoughFishMonger will become famous soon enough
I take it that you haven't starting writing any code yet, is that correct?

Are you looking for help in writing it, or are you looking for someone else to write it for you?

How much Perl experience do you have?

There are several possible approaches, but the basic approach would probably be to parse each file loading the data into a database. That database data could then be used to generate a single "master" hosts file which is then uploaded to each server.
FishMonger is offline   Reply With Quote
Old 04-30-2010, 05:42 AM   PM User | #4
rohith_sh
New to the CF scene

 
Join Date: Apr 2010
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
rohith_sh is an unknown quantity at this point
Smile

Yes, I have very limited perl knowledge. Actually I cant figure out what language would be more suitable for my requirement.

What I want to do is, suppose there's FileA, which has the lines

a
b
b
b
b
c
d

And FileB which has the lines

b
c
c
d
e

and FileC which has the lines

c
d
e
f
f


The Final file should contain,

a
b
c
d
e
f


I.e remove duplicates and merge them. Is there a necessity for a database?
I wud be happy if someone wud code it for me :P
rohith_sh is offline   Reply With Quote
Old 04-30-2010, 02:06 PM   PM User | #5
FishMonger
Super Moderator


 
Join Date: May 2005
Location: Southern tip of Silicon Valley
Posts: 2,753
Thanks: 2
Thanked 149 Times in 144 Posts
FishMonger will become famous soon enoughFishMonger will become famous soon enough
This would be an easy script to write, provided you have a working knowledge in the language you want to use.

If you want to write this script in Perl, I will be happy to help you when you get stuck. However, I'm not interested in writing it for you. If you need hire someone to write it for you, then it would be best to place a request in the proper section of this forum.

http://codingforums.com/forumdisplay.php?f=56
FishMonger is offline   Reply With Quote
Old 05-01-2010, 10:49 AM   PM User | #6
rohith_sh
New to the CF scene

 
Join Date: Apr 2010
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
rohith_sh is an unknown quantity at this point
Cool

Thanks!
rohith_sh is offline   Reply With Quote
Reply

Bookmarks

Tags
hosts, http upload, merge

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 04:31 PM.


Advertisement
Log in to turn off these ads.