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

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

john
Posts: 1
Joined: Thu Jul 21, 2005 5:02 pm

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

Postby john » Thu Jul 21, 2005 5:23 pm

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

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

Postby DataMystic Support » Mon Aug 22, 2005 12:52 pm

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.
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


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

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 9 guests