in reply to Re^16: How do I use grep in a script
in thread How do I use grep in a script

Thanks poj This appears to be what I am looking to accomplish!!

Replies are listed 'Best First'.
Re^18: How do I use grep in a script
by Flintlock (Novice) on Dec 29, 2017 at 14:40 UTC
    There is a glitch in the way Acct: is searched for.

    I need to delimit each record by "STATUS Acct:"

    My attempts are producing no results

    if (/\"STATUS Acct:\"(\d+)/)

    I think I would need to escape the quotes, but maybe not?

    I can grep this from the command line and get the correct results without escaping the quotes.

    Any Ideas?

      If you don't need to keep the quotes just remove them before the match

      while (<$fh>){ next unless /\S/; # skip blank lines s/"//g; # remove all "

      or if they are optional try

      if (/STATUS\s+Acct:"?(\d+)/){ $acct = $1; }

      See perlretut

      poj
        Got it poj -- THANKS