开发者

help in perl regex using command line

开发者 https://www.devze.com 2023-03-06 01:18 出处:网络
I have regex expression: echo \"(1508,\'2011-02-28\',\'pc\',\'postr开发者_如何学运维oll\',\'ai-postroll\',\'HT\',\'\',\'\',16),(1508,\'2011-02-28\',\'pc\',\'postroll\',\'ai-postroll\',\'MU\',\'\',\'\

I have regex expression:

echo "(1508,'2011-02-28','pc','postr开发者_如何学运维oll','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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消