Reputation: 13890
I want to delete all lines begin with 'sometext' from many files:
find . -name "*.php"|xargs -I {} sed -e '/^sometext/d' {}
But this put me output to console. How to modify this files directly?
Upvotes: 1
Views: 71
Reputation: 58507
You can accomplish this with exec
:
find . -name "*.php" -exec sed -i '/^sometext/d' {} \;
Upvotes: 0
Reputation: 425428
Tell sed to modify the files "in place":
find . -name "*.php" | xargs sed -i '' -e '/^sometext/d'
Note that the blank ''
after -i
is required, otherwise a new copy with a default suffix will be created.
Also note the pruning if your unnecessary -I
in xaegs
Upvotes: 1