Reputation: 3514
I'm running this but it doesn't seem to replace anything:
perl -p -i -e 's/page?user_id=/page?uid=/g' *
What am I doing wrong here?
I want to replace page?user_id=
with page?uid=
Upvotes: 1
Views: 226
Reputation: 1578
The '?' is a special character, indicating that the e needs to be matched 0 or once, so it needs to be escaped if you want to search for a '?' instead of an optional 'e'. Escaping with '\':
try
s/page\?user_id=/page?uid=/g
Upvotes: 5
Reputation: 3535
You can also use Quotemeta:
perl -pi -e 's/\Qpage?user_id=\E/page?uid=/g' file
As a side note I thought why don't you change only user_id
to uid
.
Upvotes: 3