Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Apr 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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 )

  • #2
    New to the CF scene
    Join Date
    Apr 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nothing yet guys?

  • #3
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,916
    Thanks
    2
    Thanked 164 Times in 159 Posts
    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.

  • #4
    New to the CF scene
    Join Date
    Apr 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #5
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,916
    Thanks
    2
    Thanked 164 Times in 159 Posts
    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/small-projects-quick-fixes-changes/

  • #6
    New to the CF scene
    Join Date
    Apr 2010
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool

    Thanks!


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •