shashuec
shashuec

Reputation: 694

help in perl regex using command line

I have regex expression:

echo "(1508,'2011-02-28','pc','postroll','ai-postroll','HT','','',16),(1508,'2011-02-28','pc','postroll','ai-postroll','MU','','',11),(1508," | perl -pe "s|,(\d+)\)|,'',($1)\)|g"  

I am trying to replace the number before closing parenthesis with an extra value.
So '',16) would be replaced by ,'',''16) .

I am finding issue that $1 is not getting replaced.Please let me know what is that I am doing wrong.

Thanks in advance

Upvotes: 1

Views: 541

Answers (1)

Brian
Brian

Reputation: 15706

Since you used double-quotes, bash will try to substitute a value for $1. Try replacing it with \$1.

Upvotes: 5

Related Questions