Reputation: 127
I would like to replace "int" with "int int int" in a file practice.py. The below code is not working.
perl -p -i -e "s/int/int{3}/g" practice.py;
Upvotes: 1
Views: 89
Reputation: 50637
perl -i -pe 's/(int)\K/ $1 $1/g' practice.py
(-pe ".."
if using windows)
Upvotes: 2
Reputation: 9770
perl -p -i -e "s/int/int int int/g" practice.py;
The {3}
can only be used to match in a regex not in a substitution.
Upvotes: 1