Convert fields from text files to CSV

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

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

Convert fields from text files to CSV

Post by ptr727 »

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: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Convert fields from text files to CSV

Post by DataMystic Support »

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@"

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

Re: Convert fields from text files to CSV

Post by ptr727 »

Thx
Post Reply