Thursday 15 August 2013

php - Osx: delete all first line of multiple files -



php - Osx: delete all first line of multiple files -

i read lot of threads question, cannot figure out how resolve problem.

i have lot of wordpress files start wrong first line. think wordpress hacked, , every .php file starts long set of functions, in first line.

i tried delete first line of every file via terminal, sed.

i run command

find . -type f -name "*.php" | xargs sed -i '' '1d'

but removes first line on first file; don't know why.

hope it's not answered question.

thank in advance.

you don't need go xargs, find's builtin function -execdir help run external command on find itself.

find . -type f -name "*.php" -execdir sed -i '1d' {} \;

or

find . -type f -name "*.php" -execdir sed -i '' '1d' {} \;

php wordpress osx sed

No comments:

Post a Comment