Ashok Gadri
Ashok Gadri

Reputation: 518

How to replace strings in all files using sed?

I want to replace below line with next line in all the files. So what sed pattern is used for this. I have tried lot but not figured that out..

checkToken($token['token'])
checkToken($token)

This is what I have tried

sed -i -- 's/checkToken\(\$token\['token'\]\)/checkToken\(\$token\)/g' get_officers_v2.php

Upvotes: 0

Views: 62

Answers (1)

UlfR
UlfR

Reputation: 4395

You just need to get your escape-characters (\) on the right place like:

sed -ie "s/\(checkToken(\$token\)\['token'\])/\1)/" get_officers_v2.php

Upvotes: 1

Related Questions