[X-Unix] How to *quietly* unarchive a .bz2 file?

Robert Frank robert.frank at unibas.ch
Sun Oct 3 23:31:53 PDT 2010


Well, Jerry, I'm astonished that all which responded missed the point:

tar DOES handle bzip (according to the man page), but no  
automatically. You really just have to read the manpage and you will  
see that you have to use the -j flag.

tar xjf /var/log/system.log.0.bz2  (note the j in the option list)

should do the trick too.

-Robert

On 03/10/2010, at 21:00 , Jerry Krinock wrote:

> For remote diagnosis of problems, I have a script which  
> unarchives .bz2 system logs, filters them for certain keywords, and  
> zips the resulting text into an archive which the user can email to  
> me.
>
> This works except that for unarchiving the .bz2 logs, I use /usr/bin/ 
> open, which launches the Archive Utility app, which opens a Finder  
> window that activates for each .bz2 file, creating visual pollution  
> and intercepting any keystrokes which the user might be typing in  
> another app.  Very annoying.
>
> Archive Utility.app is in /System/Library/CoreServices and has no  
> documentation.
>
> It appears that on Linux, people use 'bunzip' or 'tar -x' for this.   
> Well, bunzip seems to not exist on Mac OS X, and although 'man tar'  
> says that "this implementation recognizes bzip2 compression  
> automatically when reading archives", it doesn't work on a .bz2?
>
> JerryMacMini:~ jk$ tar -x -f /var/log/system.log.0.bz2
> tar: This does not look like a tar archive
> tar: Skipping to next header
> tar: Archive contains obsolescent base-64 headers
> tar: Error exit delayed from previous errors
>
> I get the same problem if I use the -j option (which, according to  
> 'man tar', is not necessary for extracting)
>
> JerryMacMini:~ jk$ tar -x -j -f /var/log/system.log.0.bz2
> tar: This does not look like a tar archive
> tar: Skipping to next header
> tar: Archive contains obsolescent base-64 headers
> tar: Error exit delayed from previous errors
>
> How can I quietly unarchive a .bz2 file?
>
> Thanks,
>
> Jerry
>

Departement Informatik   HPWC   tel   +41 (0)61 267 14 66
Universität Basel                              fax. +41 (0)61 267 14 61
Robert Frank
Klingelbergstrasse 50                     Robert.Frank at unibas.ch
CH-4056 Basel
Switzerland                                        http://www.informatik.unibas.ch/personen/frank_r.html






More information about the X-Unix mailing list