I am trying to delete some line in PHP files. I tried to use an find, exec combination:
find . -name '*.php' -exec sed '/@category/d' {} \;
but it only prints out the files contents. Is there anythin wrong in the syntax? Or what is the problem?
I am trying to delete some line in PHP files. I tried to use an find, exec combination:
find . -name '*.php' -exec sed '/@category/d' {} \;
but it only prints out the files contents. Is there anythin wrong in the syntax? Or what is the problem?
Could you try this command:
find . -name '*.php' -exec sed -i '/@category/d' {} \;
I think you've missed -i option
It works, but probably not how you expect.
find . -name '*.php' -exec sed -i '/@category/d' {} \;
Will kill the lines in question.
This should be the command for sed so try to add -i :
sed -i ".bak" '/culpa/d' test.txt
find . -name '*.php' -exec sed -i '/@category/d' {} \;
Source of the answer: Bash - find a keyword in a file and delete its line