I want to process PHP files on the content but i’m only interested in the parts between < ?php … ?>. The rest should be removed and saved to a new file. Below I’ve already part of the code based on the code from this page multi line sed search. But it only gives the first part in .
start="<?php"
end="?>"
temp=$(sed -n '1h;1!H;${;g;s/.*'"$start"'//pI;d;}' <<< echo $filename)
output=$(sed -n '1h;1!H;${;g;s/'"$end"'.*//p;d;}' <<< "$temp")
Somebody has a solution? awk, grep is also oké. THanks
this one-liner may work for you:
if you don’t want the
<?phpand?>in output:test: (I hope the output is what you are looking for. to save to new file, you could redirect output to a new file)