?
Solved

Import pipe-delimited text data that contains multi-line fields

Posted on 2014-03-12
2
Medium Priority
?
1,183 Views
Last Modified: 2014-03-28
Hi,

I have a pipe-delimited text file that has multi-line fields.

test.txt
I need to import this file to MS Access or Excel (this was exported out from Oracle).
The desired results are :

results.xlsx
However, there's a line space ('cr lf') after every line, and when I import it to Excel, they get separated to different lines even though they should all be in one cell if they are between pipes.
How can I import this to Excel as 3 column, multi-line?

Thank you.
0
Comment
Question by:iamnamja
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 38

Assisted Solution

by:PatHartman
PatHartman earned 1000 total points
ID: 39924264
You would have to write code.  No standard import can handle such a mess.

I don't see any of identifying where one "record" stops and another record begins unless there is always a blank line between records.  Your code would have to read each record and determine whether it was part of the previous column or should start a new column or a new record.
0
 
LVL 38

Accepted Solution

by:
Jim P. earned 1000 total points
ID: 39924905
I have to agree with Pat -- the data is a mess.

Unless there is some kind of indicator of what the start of each individual record is trying to build a good import routine will be very hard.

If there is a consistent number of rows for each one you could possibly pull it into a staging table with just an autonumber and a data column. Then go through and pull row "1" into a variable, then row 2,3, and 4 into another variable, 5,6, and 7 into the next and then write to another table. Rinse and repeat as needed.

You may also consider if you want the column B and C to look like that or break it out to more columns.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question