Skip to content
Advertisement

Search and Replace under linux?

I tried the following but not adding '' this example

I want to replace FILENAME_LOGIN to 'login.php'

Tried this:

grep -r "login.php" -l | tr 'n' ' ' | xargs sed -i 's/"login.php"/'login.php'/g'

However, it gives me login.php not 'login.php'

Thanks

Advertisement

Answer

You only need sed for this:

sed -i -e "s/FILENAME_LOGIN/'login.php'/g" /your/file
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement