I have records in a file that look like this:
IPOD,YAHOO,0033092909,50/4Z1,technology_102
I would like to convert the 4Z1 to 42001 so the complete record would look like this:
IPOD,YAHOO,0033092909,50/42001,technology_
So essentially what I am trying to do is find records that have a slash / and then one or more digits followed by Z1, and convert the Z1 value to 2001, while retaining the /and the digits that proceeded the Z.
What I have tried is:
perl -pi -e "s#((/\d)Z1,)#\22001,#g" test
But I get:
IPOD,YAHOO,0033092909,50\22001,technology_102
so the value stored in \2 is getting lost.
if i try this perl command (thinking i need to concat the values together) I get a mysterious 4 (how?) followed by a period and then 2001 :
perl -pi -e "s#((/\d)Z1,)#\2.2001,#g"
IPOD,YAHOO,0033092909,50/4.2001,technology_102
Can someone help with this and explain what I am missing in the concept of using the /1 .../n values when wanting to put them with digits.
IPOD,YAHOO,0033092909,50/4Z1,technology_102
I would like to convert the 4Z1 to 42001 so the complete record would look like this:
IPOD,YAHOO,0033092909,50/42001,technology_
So essentially what I am trying to do is find records that have a slash / and then one or more digits followed by Z1, and convert the Z1 value to 2001, while retaining the /and the digits that proceeded the Z.
What I have tried is:
perl -pi -e "s#((/\d)Z1,)#\22001,#g" test
But I get:
IPOD,YAHOO,0033092909,50\22001,technology_102
so the value stored in \2 is getting lost.
if i try this perl command (thinking i need to concat the values together) I get a mysterious 4 (how?) followed by a period and then 2001 :
perl -pi -e "s#((/\d)Z1,)#\2.2001,#g"
IPOD,YAHOO,0033092909,50/4.2001,technology_102
Can someone help with this and explain what I am missing in the concept of using the /1 .../n values when wanting to put them with digits.