Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Transforming a text file to a database

  1. Aug 10, 2014 #1

    adjacent

    User Avatar
    Gold Member

    I have a list of contacts like this:
    Code (Text):

    Name ,Address:House ,Island ,Atoll  7777777
    Name ,Address:House ,Island ,Atoll  7777777
    Name ,Address:House ,Island ,Atoll  7777777
     
    I have a large number of these and I want the details to be separated to different columns. Is there any program which will do this for me?

    I tried searching google and got nothing.
    :confused:
     
  2. jcsd
  3. Aug 10, 2014 #2

    jtbell

    User Avatar

    Staff: Mentor

    Microsoft Excel's "import wizard" (which you get automatically when you open a text file in Excel) can be used to remove the commas and the colon, and open the file as a spreadsheet. Then you can save it as a tab-delimited text file if that's more suitable for you than an Excel spreadsheet.

    The Open Office clone of Excel might have a similar import wizard.
     
  4. Aug 10, 2014 #3
    Yes, you can do it with Open Office. Open a new spreadsheet and on the main menu click "Insert". Then click "Sheet From File". A dialog box will appear where you can select what delimiters you want to use.
     
    Last edited: Aug 10, 2014
  5. Aug 10, 2014 #4

    Borg

    User Avatar
    Gold Member
    2015 Award

    If you include the word 'parse' in your search, you will get lots of hits - how to parse a text file.
    But, as posted, Excel is quick and easy.
     
  6. Aug 10, 2014 #5

    adjacent

    User Avatar
    Gold Member

    Oh, I didn't know Excel was that great :smile:. I think I should learn MS office products more.

    Thanks guys.
     
  7. Aug 10, 2014 #6

    jtbell

    User Avatar

    Staff: Mentor

    I was able to open and fix up your small sample (after copy-and-pasting it into a text file) as I described it, using Excel for Mac 2011. The details may differ for you depending on which version you have, but it took me only a couple of minutes to figure it out in the "wizard."
     
  8. Aug 10, 2014 #7

    adjacent

    User Avatar
    Gold Member

    Yeah, I got it done too.I opened the text file in excel and the wizard opened :smile:
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted