Re: using sed to add text to csv file

Thierry Blanc <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
something like

sed '
s|^|firstname=|;
s|,|\&lastname=|;
s|,|\&address=|;
...
'

The ^ sign means beginnning of line.

to change a comma into ampersand, you will have to quote it, otherwise 
it means 'entire search string'

The part of inserting headername= I don't understand.
What value do you want for headername? Or do you want just an empty 
headername
headername=&firstname=....



On 04/05/12 15:44, Gary Carr wrote:
> Hello to all. This is my first post to this mailing list.
>
> I have a CSV file with thousands of lines that is laid out like such.
>
> First,Last,Address,City,St,Zip,email,phone,dob,optindate,ipaddress,url
> Joey,Smith,12036 Address Lane,Beverly Hills,CA,90210,[email protected],2484865073,02/08/1962,4/2/2008 19:04:20,192.69.141.22,http://www.url.com/
>
> I am trying to add text to the beginning of each table then change each line to the following
>
>
> firstname=Joey&lastname=Smith&address=12036 Address Lane&
>
> So basicallly I am trying to add the "headername=" text to the beginning of each row then replace the , with a&  I know how to replace the comma I just can not figure out how to add the header text to the beginning of each line.
>
>
> Thanks,
>
> Gary
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.