Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2013

    convert txt's to DB

    Hi, I have approximately 3000 txt files of the format attached. I'm looking for the simplest way to convert them into one .csv for import into a DB. The field length is determined by the dashes on row 7 (some fields fluctuate from one file to the next, in length), the rows before row 7 can be discarded.

    I have to believe there is an easy way to do this, perhaps a script that could read the first file, delimit according to row 7, export into a csv and then repeat the process for each file.
    I'm a complete newbie.

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2004
    out on a limb
    easy way: no, but it can be done
    you don't say what the destination db is, but if it were me I'd probably import into Accessand then forward onto the final db
    I'd edit out the first 7 lines, then used a fixed format import specification and import fiels manually

    if there was enough time and money I might be convinced to write a procedure that scanned a specified directory then imported the data, but I'd need to have a clear idea of what makes the data unique so you don't get duplicates.

    of course the smart aleck answer woudl be to go to the source of the data and get it sent 'au nature'
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Feb 2004
    In front of the computer
    PowerShell on Windows or Perl on anything else would cheerfully eat this problem alive.

    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

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