Hi all, Everyday we get tow .txt files that contain tab delimiter data. Let’s call then A.txt and B.txt. A.txt example: mrimanager version 4.9 date processed 3/08/06 11:47:29 image file type GENESIS ***************************** CHRONOLOGICAL ORDER 1 ****************************** ---------- EXAM DATA ---------- Suite ID for this Exam : LCMR Make-Unique Flag : 0 Disk ID for this Exam : Exam Number : 9909 Hospital Name : Stanford Lucas MR Detector Type : 0 Number of cells in det : 0 Cell number at theta : 0.000000 Cell spacing : 0.000000 B.txt example: ***************************** CHRONOLOGICAL ORDER 1 ****************************** Hospital Name: San Jose Hosp Patient ID: A. Someone Patient Name: First Last Patient Age: 8 Patient Sex: Male Patient Weight [grams]: 65359 Patient History: Referring Physician: Diagnostician: Operator: JJ Exam Number: 29292 Exam Description: BRAIN 04/16/1994 Exam Type: MR Exam Date and Time: 11/10/04 12:30:14 Also, in SQL server we have a table let’s call it MRI. I need to hand pick the tab delimiter data from both .txt files and consolidate them in one .txt or Excel sheet or anyother way around then insert them as one record in to MRI table in MS SQL Server. I have done all the above tasks in VBA successfully by using MS Excel on Windows Platform. But, now I need to do the same task on MAC OSX. I was wondering if the above tasks possible by using Java Scripts on MAC OSX, or if there is any tools out there to use on MAC OSX. Thanks for any help. Regards, Abrahim
it can be done with a java program. Use FileReader & BufferedReader to read the file line by line. While you're reading it, split the retrieved line by using the \t (tab) as delimiter: try { FileReader filereader = new FileReader ( new File ( "A.txt" ) ); BufferedReader bfr = new BufferedReader ( filereader ); String line; while ( (line = bfr.readLine () ) != null ) { String[] data = line.split( "\t" ); } } catch ( IOException e ) { e.printStackTrace(); } Code (markup): The data variable contains the name and value of the information on 1 line. So during the while loop, you will have to insert it into your database.