[SLUG] Need help with a sed script

From: Russ Wright (rwrigh10@tampabay.rr.com)
Date: Sat Aug 02 2003 - 09:56:35 EDT


Hey all
I have a simple script to perform a find and replace for me. Currently it
looks for "<?" and replaces it with "<?php".

for fl in *.php; do
mv $fl $fl.old
sed 's/<? /<?php /g' $fl.old > $fl
rm -f $fl.old
done

Works pretty well.

However I need to make it a little smarter. I need the script to find any of
the following "<? ", "<?=", "<?(carriage return)" and replace it with
<?php. However it must not replace "<?php" with "<?phpphp".

Any ideas?

Regards
Russ

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 15:55:33 EDT