3

Ive 30 files named ( db01.php up to db30.php )

include this line

     require_once('config.php');

I want to add or replace it to be

    require_once('../new/config.php');

how to use sed to edit these 30 files at once

2 Answers 2

3
sed -i 's/\(require_once(.\)\(config\.php.);\)/\1..\/new\/\2/' db*.php
Sign up to request clarification or add additional context in comments.

Comments

0
sed -i "s/\(require_once('\)\(.*\.php\)\(');\)/\1..\/new\/\2\3/" db*.txt

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.