2 Replies Latest reply on Oct 5, 2012 1:04 PM by vaaru

    To remove the null value using awk on RHEL5


      this is some lines from /var/log/secure
      Oct 4 09:55:31 dcvlodbdev su: pam_unix(su-l:auth): authentication failure; logname=oratest uid=501 euid=0 tty=pts/1 ruser=oratest rhost= user=one
      Oct 4 10:56:06 dcvlodbdev sshd[9131]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost= user=oratest

      i am using this awk cmd for our reqiurment,

      /bin/grep "$CUR_DATE" /var/log/secure | grep -i failure | awk '{ print $1, $2"  ", $3" ",$14"  ", $15 }' >> /tmp/failed-logins.txt

      I received the output as,
      Oct 4 10:56:06 logname= rhost= user=oratest
      Oct 4 10:56:37 logname=oratest rhost= user=root

      But i only need the ouput like this,

      Oct 4 10:56:06 logname= rhost= user=oratest

      i dont need the "rhost= "
      how to avoid the rhost="null" in awk