sed - Change PHP tags with shell command -
sed - Change PHP tags with shell command -
my problem this: seek alter tags (<? <php?) in several scripts next command:
find . -name "*.php" -type f -print0 | xargs -0 sed -i -e 's/<? /<?php /g' the problem if have label <?echo'ble bla..'; ignores , not change. recommend doing?
you utilize next sed command:
find -type f -name "*.php" -exec sed -i ':a;n;$!ba;s/<?\([ \n]\|echo\)/<?php \1/g' {} \; it matching either space or newline or term echo after <? , replaces <?php<match_found>
note don't need xargs call. can utilize find's -exec option. -e alternative sed not necessary long using single expression. -type criteria should before -name option. otherwise find throw warning.
php sed gnu-findutils
Comments
Post a Comment