Convert fields from text files to CSV

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

ptr727
Posts: 2
Joined: Thu Feb 07, 2013 6:43 am

Convert fields from text files to CSV

Postby ptr727 » Thu Feb 07, 2013 6:51 am

Hi

I need to process text files created by an automation process.
The text files have a fixed format, and I need to convert sections of each file into fields in a CSV file.
Where each text file will be a new line in the CSV file.

E.g. [row 6 : 0 to 12], [row 6 : 14 to 20], [row 10 : 14 to 20], etc.

I'd also like to trim any whitespace around any of the resulting fields before inserting into CSV file.

I looked at the docs and samples but could not find a way or wizard to extract fixed location fields into a CSV file.

Any advice?

P.

User avatar
DataMystic Support
Site Admin
Posts: 2138
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Convert fields from text files to CSV

Postby DataMystic Support » Fri Feb 08, 2013 8:02 am

Hi Pieter,

Using your example, an EasyPattern like this:

Code: Select all

[ 5 (0+ lineChar, crlf),  ;first 5 lines
  capture(13 chars) as 'field1', ' ',
  capture(7 chars) as 'field2', 0+ lineChar, crlf,
  2 (0+ lineChar, crlf),  ;lines 7-9
  13 chars, capture( 7 chars ) as 'field3' ]


And replace with:

Code: Select all

"@field1@","@field2@","@field3@"

Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

ptr727
Posts: 2
Joined: Thu Feb 07, 2013 6:43 am

Re: Convert fields from text files to CSV

Postby ptr727 » Fri Feb 08, 2013 8:45 am

Thx


Return to “TextPipe Tips and Tricks, Questions and Support”

Who is online

Users browsing this forum: Baidu [Spider], Yahoo [Bot] and 5 guests