Page 1 of 1

add field and append 2 fields into new added field; reformat

Posted: Thu Jul 21, 2005 5:23 pm
by john
Example: csv file with a header

"name","addr1","filler","addr2","city"
"john","123 main st","-","apt 1024","pensacola"


Would like new output to look like
"name","address","city"
"john","123 main st apt 1024","pensacola"


I would like to process the csv file with header taking addr1 and addr2 merging them into a new field called street then remove the addr1, filler and addr2 fields.

Thanks for the help

Posted: Mon Aug 22, 2005 12:52 pm
by DataMystic Support
Use an EasyPattern along these lines:

[ capture( csvfield ), ',',
capture( csvfield ), ',',
capture( csvfield ), ',',
capture( csvfield ), ',',
capture( csvfield ), cr, lf,
capture( csvfield ), ',',
capture( csvfield ), ',',
capture( csvfield ), ',',
capture( csvfield ), ',',
capture( csvfield ), cr, lf ]

Replace with

$1,$2,$3 etc in the order you need.