Question : Sed, Awk or Bash - Pull text out of a line

I am trying to parse a PAM file to get a value for a variable.  I am having some problems pulling some information from a line in the file.  It is fairly straight forward to get the correct line from the file with grep -Ei or sed or even awk.  The problem I am having is getting a certain bit of information from the line.  The line is something like this:
account     required      /lib/security/$ISA/pam_tally.so per_user deny=3 onerr=fail no_magic_root reset. I am able to get the line I need by doing something like this:
sed  -n '/^account.*pam_tally.*deny/p' /etc/pam.d/system-auth  - obviously there are a number of ways to do this (grep & awk also).  What I need is a way to get the "5" in the "deny=5" section of the line.   If the deny=5 was guaranteed to be in the same place (same field number) it would be pretty easy, but it is not.  I could use cut or awk etc.  Is there good way to get this data ( the 5 ) without knowing were in the line it may be.   I need to use sed, awk, or bash type commands.

Thank You  

Answer : Sed, Awk or Bash - Pull text out of a line

perl -ne 'print "$1\n" if /^account.*pam_tally.*deny=(\d+)/' /etc/pam.d/system-auth

awk '/^account.*pam_tally.*deny/{sub(/.*deny=/,"");sub(/[^0-9].*/,"");print}' /etc/pam.d/system-auth
Random Solutions  
 
programming4us programming4us