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
add field and append 2 fields into new added field; reformat
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:
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.
[ 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.