1

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

1 Answer 1

5

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.