Dear all Salam, i have installed logrotation package in BSD, the script runs every night at 3:00 pm night and makes filename.1.gz. but when i use less command to see this gz file it says "do u want to see binary file??" through which utility i can see the contants of the file??? Regards, Umair Shakil ETD -------------- next part -------------- An HTML attachment was scrubbed... URL: <lists.centos.org/pipermail/centos/attachments/20071019/b322e628/attachment-0004.html>
umair shakil wrote:> Dear all Salam, > > i have installed logrotation package in BSD, the script runs every night at > 3:00 pm night and makes > filename.1.gz. but when i use less command to see this gz file it says "do u > want to see binary file??" > through which utility i can see the contants of the file???If BSD works like Centos, you could use: gunzip -c filename.1.gz|less Mogens -- Mogens Kjaer, Carlsberg A/S, Computer Department Gamle Carlsberg Vej 10, DK-2500 Valby, Denmark Phone: +45 33 27 53 25, Fax: +45 33 27 47 08 Email: mk at crc.dk Homepage: crc.dk
"umair shakil" <umairshakeel at gmail.com> wrote:>>when i use less command to see this gz file it says "do u want to see binary file??" through which utility i can see the contants of the file??? << All right, I'll bite. You could use zcat. But if you really want to use less to *automatically* unzip a .gz file, then you can create a less preprocessor: Use vi to create /usr/local/bin/lesspipe.sh and type in the following text: #!/bin/bash case "$1" in *.Z) uncompress -c $1 2>/dev/null ;; *.gz) gunzip -c $1 2>/dev/null ;; esac Make the lesspipe.sh file executable ('chmod +x /usr/local/bin/lesspipe.sh') and then create a LESSOPEN environment variable to make less use it: export LESSOPEN="|/usr/local/bin/lesspipe.sh %s" Test that this works, by cd'ing to /usr/doc/HOWTO, and if all is OK, add the export line to /etc//bashrc so that it takes permanent effect. Obviously, the lesspipe.sh script can be extended to do other things. All this is basically in the less man page, of course. Best, --- Les Bell, RHCE, CISSP [lesbell.com.au] Tel: +61 2 9451 1144 FreeWorldDialup: 800909