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 10 of 10
  1. #1
    New Coder
    Join Date
    Aug 2002
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Mutiple files from a single file

    I have a large file containing an Alumni database. Each line has a separate record and the fields in the records are delimited by pipes (|). say the fields are username, FName, LName, Address, City, State, Country ..........about 24 fields.

    Now I wish to convert this single file to mutiple files - one file of each record (each user). The username becomes the file name (username.dat) and all the other fields for the user is stored in one file one below the other.
    FName
    LName
    Address,
    City
    ..
    ..
    etc.

    Is it possible for a perl/cgi script to perform the above function.
    Help in the search for Missing Children. Paste the following applet in your Home/Web Page:

    <applet code="mikids468.class" codebase="http://www.missingindiankids.com/java/" align="baseline" width="468" height="60"></applet>

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    the Netherlands
    Posts
    215
    Thanks
    0
    Thanked 0 Times in 0 Posts
    working on it

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    the Netherlands
    Posts
    215
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It took a while, but here it is.
    And I love it, though I say it myself.

    On *nix you should use it like this:
    convert.cgi database filename
    or, if you want old userfiles overwritten
    convert.cgi database filename overwrite
    (you could also use "yes" or "1" in stead of "overwrite")
    Example: convert.cgi database.db
    Example 2: convert.cgi database.db yes

    On Win32 like this:
    perl convert.cgi database filename
    or, if you want old userfiles overwritten
    perl convert.cgi database filename overwrite
    (you could also use "yes" or "1" in stead of "overwrite")
    Example: perl convert.cgi database.db
    Example 2: perl convert.cgi database.db yes

    Mzzl, Chris

    P.S. The file's attached
    Attached Files Attached Files

  • #4
    New Coder
    Join Date
    Aug 2002
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tried running it but I don't know where it saved the files.

    Opening database file: database.db Reading data Creating files: Working on filename Opening filename.dat Saving data Data

    I am unable to run this script on the PC. I am, however, able to run other cgi scripts on my PC. I have Perl and apache installed on my PC
    Help in the search for Missing Children. Paste the following applet in your Home/Web Page:

    <applet code="mikids468.class" codebase="http://www.missingindiankids.com/java/" align="baseline" width="468" height="60"></applet>

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    the Netherlands
    Posts
    215
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It saves the files in the dir where you run convert.cgi

    Mzzl, Chris

  • #6
    New Coder
    Join Date
    Aug 2002
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks the script is just too good. I was able to run it on my PC and convert the files. On the server I couldn't find the converted files.

    2nd Request.
    Can we reverse the script. Where it reads the multiple files and converts into a single file.
    Help in the search for Missing Children. Paste the following applet in your Home/Web Page:

    <applet code="mikids468.class" codebase="http://www.missingindiankids.com/java/" align="baseline" width="468" height="60"></applet>

  • #7
    New Coder
    Join Date
    Aug 2002
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The files are there on the server also. Once again thanks a lot.
    Help in the search for Missing Children. Paste the following applet in your Home/Web Page:

    <applet code="mikids468.class" codebase="http://www.missingindiankids.com/java/" align="baseline" width="468" height="60"></applet>

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    the Netherlands
    Posts
    215
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by GurusGuru
    2nd Request.
    Can we reverse the script. Where it reads the multiple files and converts into a single file.
    I'll have a look at that today, but first I have to go to school
    I'll be back around 4:00 PM (GMT+1)

    Mzzl, Chris

  • #9
    Regular Coder
    Join Date
    Jun 2002
    Location
    the Netherlands
    Posts
    215
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here is the new file, it contains 4 files; two docs and two programs.

    I did a little update to convert.cgi too.

    Mzzl, Chris

    Edit: P.S. tell me what you think
    Attached Files Attached Files

  • #10
    New Coder
    Join Date
    Aug 2002
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Genius.... Both the scripts are fantastic and they work beautifully.

    Thanks again.
    Help in the search for Missing Children. Paste the following applet in your Home/Web Page:

    <applet code="mikids468.class" codebase="http://www.missingindiankids.com/java/" align="baseline" width="468" height="60"></applet>


  •  

    Posting Permissions

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