Operating System - HP-UX
1831061 Members
2375 Online
110019 Solutions
New Discussion

mailx: deleted 251 NULL characters in mail file ERROR

 
SOLVED
Go to solution
NDO
Super Advisor

mailx: deleted 251 NULL characters in mail file ERROR

Hi All

 

I have the following script:

 

#!/usr/bin/ksh
if (grep -E 'Year' /tmp/fr/prep03.280111)
 then
   mailx -s "Error from log" fxxx@yyy.com < /tmp/fr/prep03.280111
fi

 

The idea is to mail me the all  lines containing that string "Year" on that file

 

But I am having the following error:

 

Year 2000 patches (ONLY for OS !!!!)
Year 2000 patches (ONLY for HP-UX Application !!!!)
mailx: deleted 251 NULL characters in mail file


 

FR

7 REPLIES 7
Dennis Handly
Acclaimed Contributor

Re: mailx: deleted 251 NULL characters in mail file ERROR

There is no need for -E if you just want "Year".

 

>But I am having the following error:

 

What error?  Your input file seems to have NULs in it.  You can ignore it.

NDO
Super Advisor

Re: mailx: deleted 251 NULL characters in mail file ERROR

What I am receiving on my inbox is the all file, I just want the all line containing that word "Year"
Dennis Handly
Acclaimed Contributor
Solution

Re: mailx: deleted 251 NULL characters in mail file ERROR

>I just want the all line containing that word "Year"

 

Then you need to redo the grep or save the file:

if grep -q 'Year' /tmp/fr/prep03.280111; then
   grep 'Year' /tmp/fr/prep03.280111 | mailx -s "Error from log" fxxx@yyy.com

fi

NDO
Super Advisor

Re: mailx: deleted 251 NULL characters in mail file ERROR

Did come right now, but I had the following message on the terminal:
NIS map mail.aliases specified, but NIS not running
NDO
Super Advisor

Re: mailx: deleted 251 NULL characters in mail file ERROR

Hi Dennis!

 

It does work fine, but if I wanted to change to only search that word in the last 200 lines of the file... otherwise it will be repeating the sending the same lines again and again...

Dennis Handly
Acclaimed Contributor

Re: mailx: deleted 251 NULL characters in mail file ERROR

>but if I wanted to change to only search that word in the last 200 lines of the file

 

TMP=/tmp/fr/last.$$

tail -200 /tmp/fr/prep03.280111 | grep 'Year' > $TMP

if [ -s $TMP ]; then
   mailx -s "Error from log" fxxx@yyy.com < $TMP

fi

rm -f $TMP  # cleanup

NDO
Super Advisor

Re: mailx: deleted 251 NULL characters in mail file ERROR

Hi,
In the end I used a tail, so it gave the result that I wanted, but..

thanks a lot for your help

FR