LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   slackpkg check-updates (http://www.linuxquestions.org/questions/slackware-14/slackpkg-check-updates-4175490218/)

rogan 01-05-2014 07:43 AM

slackpkg check-updates
 
Hello fellow slackers.
I have a small problem regarding the output of slackpkg check-updates.
I run the command above as a cron job and I'm mailing the output to root, but I cant open it in mailx which claims it has binary content.

If I run slackpkg check-updates >tmp and then open tmp in pico I get this:
No news is good news
^[[?12l^[[?25h

I suppose the characters on the second line is the problem...
Should I filter them out or what gives ?

Lirey 01-05-2014 01:13 PM

It appears that the slackpkg script is hiding the cursor while running and that control sequence in the output file is what makes it visible again. I suspect that the real problem is the control sequence to hide the cursor.

The script probably needs to be fixed/tweaked to work better when the output is sent to a file or another script, but the easy and quick solution is to filter the output doing something like:

slackpkg check-updates | grep -i news > tmp

rogan 01-05-2014 01:40 PM

That works!
Thanks a bunch :)

Edit:
I found a way to remove all non-alphanumeric chars with sed.
Problem solved :)


All times are GMT -5. The time now is 10:11 AM.