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.
Convert fields from text files to CSV
Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators
- 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
Hi Pieter,
Using your example, an EasyPattern like this:
And replace with:
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' ]
Code: Select all
"@field1@","@field2@","@field3@"