I want my awk code grab whatever is inbetween and including the "<?php" and "?>".
Then, it should scan all the entries between these two points. And if the entries between these two points contain the pattern "phpinfo" AND "hlight", i dont want it to output anything.
If it doesn't containing the aforementioned two patterns, then I want it to print everything between and including the "<?php" and "?>".
i would like to do this in awk. but when i run this command, i get this:
awk: warning: escape sequence `\?' treated as plain `?'
i intend to use this on Linux Ubuntu, RedHat and AIX systems, so it needs to be portable.
an example of what im trying to do can be summed up this way:
PHPFILE='#!/usr/bin/php
<?php
phpinfo();
hlight_file(__FILE__);
?>'
CHECK=$(printf "%s\n" "${PHPFILE}" | egrep "phpinfo|hlight_file")
if [ -z "${CHECK}" ] ; then
printf "%s\n" "${PHPFILE}"
fi
as you can see here, i can accomplish what I want with the above. but, i want it to be shortened through awk so im not making any unnecessary external calls to system tools.