There's enough code here that I'm not even going to try. However, your data looks almost like json (minus the quoting). If this is the case, you'll probably want to build up an array of hashes and use JSON::XS. On Jul 13, 2013 6:16 AM, "Rob Dixon" <rob.di...@gmx.com> wrote:
> On 12/07/2013 12:44, Agnello George wrote: > >> hi >> >> i have raw data that is like this in a flat file . >> >> start >> name:agnello >> dob:2 april >> address:123 street >> end >> start >> name:babit >> dob:13 april >> address:3 street >> end >> start >> name:ganesh >> dob:1 april >> address:23 street >> end >> >> >> i need to get the data in the following format >> >> name:agnello, dob:23 april ,address:123 street >> name:babit,dob:13 april,address:3 street >> name:ganesh,dob:1 april,address:23 street >> > > perl -0777 -ne "s/\s*\n/,/g;s/start,//g;s/,**end,/\n/g; print" data.txt > > Rob > > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > >