grep command with an apostrophe

Using grep, I'm looking for a string

<?php $r1586 = 202;$GLOBALS['odcc9']

I can't close the last apostrophe

grep -Eiro '^<\?php\s{55,}\$\w+\s*=\s*[0-9]+\;\$GLOBALS\[''

1 answer

  • answered 2020-08-06 16:29 Cyrus

    With GNU grep and hex notation for ':

    grep -P '\<\?php \$r1586 = 202;\$GLOBALS\[\x27odcc9\x27\]' file
    

    Output:

    <?php $r1586 = 202;$GLOBALS['odcc9']