#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    8
    Rep Power
    0

    Java/C/C++ code Split text file into multiple text file


    Trying to write Java code to choose text file from computer and split into multiple text file based on field information

    Text file select:

    "First Name","Last Name","Address Line 1","Address Line 2","City","State","ZIP Code","IM Barcode","Sort Position","Tray Number"
    "Stephen","Hight","105 Thurman St","","Carrollton","GA","30117-1955","ADADFTFATTTDADADDFFTAFFFTDDTADDFTFDAFAATDFA AATFATDTFTAAFFAADAFFDT",1,1
    "Kimberly","Kendall","104 Thurman St","","Carrollton","GA","30117-1956","DAAFATDATAFTADDDTTTTADTFATFFDDFTAFDDATDDAAD FTATADADFDTFDAFDDATFDA",2,1
    "James","Boles","108 Thurman St","","Carrollton","GA","30117-1956","DADFDDTFDAFADTFTATADTTDTFATAAFADTATDFTTFAAF TDDFDAFATDTTDTFTFDTTTT",3,1
    "Douglas","Kelley","110 Thurman St","","Carrollton","GA","30117-1956","TFTTTAATDFDAFTDFADFDAFFTTFATATDAAFAATTAFDTD ATFAAFDFAFFTTDTDFFAADD",4,1
    "Christine","Creel","408 Old Mill Dr","","Carrollton","GA","30117-6313","TFDDDTDAFDFFFATDATADFFDAFFTAATTAFDFFTDADDTF TTAFAFATFDATDFTTFTATFF",989,2
    "Elaine","Hobson","410 Old Mill Dr","","Carrollton","GA","30117-6313","DTFFDTAFAFDTADTDDFAFFTDFDTTTDTATDFTDAFTATFA DAAFADDTATTFFTDDTDDFDD",990,2
    "Erica","Tisinger","412 Old Mill Dr","","Carrollton","GA","30117-6313","DFFAAFTDTTADDDATDATATFAFDDFADADFDATTFFAFDDT FFADDTAFTAADTDFDAFADTF",991,2
    "Brandon","Peterson","418 Old Mill Dr","","Carrollton","GA","30117-6313","FTADAAATDATDFTTDTFDFFTTDTTFDTDDDTFAFFATATDF DAADFTDTATDFATAFDADFTT",992,2
    "Robert","Ballard","425 Old Mill Dr","","Carrollton","GA","30117-6314","TFATFFDTADADDAATFTTADFFTFFDFAFAADAAFTAAFDFD FDAFTTFATDFATFFFFTAFAD",993,2
    "Susan","Newbern","429 Old Mill Dr","","Carrollton","GA","30117-6314","AADDFFFFFATADFDTDFFDDDDFTTDTAAFDTADAFDDDAFD ADTFDFDFDDTDTAATTATAAA",994,2
    "M","Motes","431 Old Mill Dr","","Carrollton","GA","30117-6314","TATDAAFTFTTFADFDDFAFATDDAATDADFDFFFTTADDATT AAAFAATAFADDTAFTTFTTFT",995,3
    "Charles","Willis","114 Old Mill Ct","","Carrollton","GA","30117-6317","AFDDTATAADAFFDFFTAATAFTTADDFFDTFFFFDTTADDTT DATDATFFAAAFTFFADFATAD",996,3
    "Nancy","Fox","124 Old Mill Ct","","Carrollton","GA","30117-6317","DFDTATTFFDAAADDDTAATFFFTDFFTFTFFDFDFTFADDDF FADDFDFTAFFADFADTTATFA",997,3
    "Linda","Smith","126 Old Mill Ct","","Carrollton","GA","30117-6317","ATFTDAFTDTTDFTTDAFFDFTTDDADADTDTTFAFFDDATTF TAFAFFDFFADDATTTAFDDTA",998,3
    "Lance","Hatfield","112 Orion Ter","","Carrollton","GA","30117-6318","TDFAFADATAAFFFADATAAFATDTFTTTTAFFFTTFDATDAD ATDAFAFAAFFTAFDFTAFDAA",999,4
    "Dr. Lona","Bibbs","1741 Newnan Crossing Blvd E","","Newnan","GA","30265-1599","TFFTDDTADADTFDFFATFDTTTDAFFTDTDTAFTATFTAADF TFAFADTFAATFTTFTDTTDFT",1000,4


    Split text file:
    split text file1)

    Filename+traynumber 1:

    "First Name","Last Name","Address Line 1","Address Line 2","City","State","ZIP Code","IM Barcode","Sort Position","Tray Number"
    "Stephen","Hight","105 Thurman St","","Carrollton","GA","30117-1955","ADADFTFATTTDADADDFFTAFFFTDDTADDFTFDAFAATDFA AATFATDTFTAAFFAADAFFDT",1,1
    "Kimberly","Kendall","104 Thurman St","","Carrollton","GA","30117-1956","DAAFATDATAFTADDDTTTTADTFATFFDDFTAFDDATDDAAD FTATADADFDTFDAFDDATFDA",2,1
    "James","Boles","108 Thurman St","","Carrollton","GA","30117-1956","DADFDDTFDAFADTFTATADTTDTFATAAFADTATDFTTFAAF TDDFDAFATDTTDTFTFDTTTT",3,1
    "Douglas","Kelley","110 Thurman St","","Carrollton","GA","30117-1956","TFTTTAATDFDAFTDFADFDAFFTTFATATDAAFAATTAFDTD ATFAAFDFAFFTTDTDFFAADD",4,1

    Split Text file 2)
    Filename+traynumber 2:

    "First Name","Last Name","Address Line 1","Address Line 2","City","State","ZIP Code","IM Barcode","Sort Position","Tray Number"
    "Christine","Creel","408 Old Mill Dr","","Carrollton","GA","30117-6313","TFDDDTDAFDFFFATDATADFFDAFFTAATTAFDFFTDADDTF TTAFAFATFDATDFTTFTATFF",989,2
    "Elaine","Hobson","410 Old Mill Dr","","Carrollton","GA","30117-6313","DTFFDTAFAFDTADTDDFAFFTDFDTTTDTATDFTDAFTATFA DAAFADDTATTFFTDDTDDFDD",990,2
    "Erica","Tisinger","412 Old Mill Dr","","Carrollton","GA","30117-6313","DFFAAFTDTTADDDATDATATFAFDDFADADFDATTFFAFDDT FFADDTAFTAADTDFDAFADTF",991,2
    "Brandon","Peterson","418 Old Mill Dr","","Carrollton","GA","30117-6313","FTADAAATDATDFTTDTFDFFTTDTTFDTDDDTFAFFATATDF DAADFTDTATDFATAFDADFTT",992,2
    "Robert","Ballard","425 Old Mill Dr","","Carrollton","GA","30117-6314","TFATFFDTADADDAATFTTADFFTFFDFAFAADAAFTAAFDFD FDAFTTFATDFATFFFFTAFAD",993,2
    "Susan","Newbern","429 Old Mill Dr","","Carrollton","GA","30117-6314","AADDFFFFFATADFDTDFFDDDDFTTDTAAFDTADAFDDDAFD ADTFDFDFDDTDTAATTATAAA",994,2

    Split text file 3)
    Filename+traynumber 3:

    "First Name","Last Name","Address Line 1","Address Line 2","City","State","ZIP Code","IM Barcode","Sort Position","Tray Number"
    "M","Motes","431 Old Mill Dr","","Carrollton","GA","30117-6314","TATDAAFTFTTFADFDDFAFATDDAATDADFDFFFTTADDATT AAAFAATAFADDTAFTTFTTFT",995,3
    "Charles","Willis","114 Old Mill Ct","","Carrollton","GA","30117-6317","AFDDTATAADAFFDFFTAATAFTTADDFFDTFFFFDTTADDTT DATDATFFAAAFTFFADFATAD",996,3
    "Nancy","Fox","124 Old Mill Ct","","Carrollton","GA","30117-6317","DFDTATTFFDAAADDDTAATFFFTDFFTFTFFDFDFTFADDDF FADDFDFTAFFADFADTTATFA",997,3
    "Linda","Smith","126 Old Mill Ct","","Carrollton","GA","30117-6317","ATFTDAFTDTTDFTTDAFFDFTTDDADADTDTTFAFFDDATTF TAFAFFDFFADDATTTAFDDTA",998,3

    Split text file 4)
    Filename+traynumber 4:

    "First Name","Last Name","Address Line 1","Address Line 2","City","State","ZIP Code","IM Barcode","Sort Position","Tray Number"
    "Lance","Hatfield","112 Orion Ter","","Carrollton","GA","30117-6318","TDFAFADATAAFFFADATAAFATDTFTTTTAFFFTTFDATDAD ATDAFAFAAFFTAFDFTAFDAA",999,4
    "Dr. Lona","Bibbs","1741 Newnan Crossing Blvd E","","Newnan","GA","30265-1599","TFFTDDTADADTFDFFATFDTTTDAFFTDTDTAFTATFTAADF TFAFADTFAATFTTFTDTTDFT",1000,4


    Like these, Anyone has an idea how can i write a java code for this??
    Please help me. I am beginners in Java/C/C++ code. My professor told me that simple.
    Please help me guys!!
  2. #2
  3. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,699
    Rep Power
    347
    Also posted at http://www.javaprogrammingforums.com/whats-wrong-my-code/28054-java-code-split-text-file-into-multiple-text-file.html

IMN logo majestic logo threadwatch logo seochat tools logo