On 12/07/2013 20:19, Nathan Hilterbrand wrote:
On 12/07/2013 13:44, Agnello George wrote:

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 -0 -wple 's/^start\n(.*?)\nend\n/$_=$1;y{\n}{ };"$_\n"/emgs'

I love a one-liner as much as the next guy, and this one is very
cool..  but it doesn't produce output exactly like the request (no
commas).

y{\n}{,}

--
Ruud


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to