pictoru pictoru - 6 months ago 31
PHP Question

Change first line recursively in all php files using bash

I have a WordPress site and want to change first line of all php files recursively using bash. How should I do? I am not very familiar with bash.



Change first line to some other line:

sed -i '1s/.*/changed line/' *.php

Adding a line before first line:

sed -i '1s/^/changed line\n/' *.php