or
perl -pe 's/(?<=data5),/\n/' input
or
perl -F, -ane '$"=",";print "@F[0..2]\n@F[3..5]"' input
or
perl -pe '$"=s/(,.*?,.*?),/$1\n/' input
magento
ASKER
Hi Ozo ,
Worked as per my needs. Great thanks.
Can you advice what actually (?<=data5), does?
Thanks
ozo
perl -MYAPE::Regex::Explain -e 'print YAPE::Regex::Explain->new(qr/(?<=data5),/)->explain'
The regular expression:
(?-imsx:(?<=data5),)
matches as follows:
NODE EXPLANATION
----------------------------------------------------------------------
(?-imsx: group, but do not capture (case-sensitive)
(with ^ and $ matching normally) (with . not
matching \n) (matching whitespace and #
normally):
----------------------------------------------------------------------
(?<= look behind to see if there is:
----------------------------------------------------------------------
data5 'data5'
----------------------------------------------------------------------
) end of look-behind
----------------------------------------------------------------------
, ','
----------------------------------------------------------------------
) end of grouping
----------------------------------------------------------------------
perl -pe 's/(?<=data5),/\n/' input
or
perl -F, -ane '$"=",";print "@F[0..2]\n@F[3..5]"' input
or
perl -pe '$"=s/(,.*?,.*?),/$1\n/' input