On 10/3/10, Jerry Krinock <jerry at ieee.org> 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? Why go through all of that? Just e-mail the .bz2 logs to yourself and open them in Console. Then, you can do the filtering on your machine.