views:

220

answers:

4

From time to time I need to extract the contents of a shar file.

And I need to wait to have access to a *nix box to obtain the files. And I was wondering if there is a unshar utility for windows.

I can install the cygwin package but I think that is to much for only extract files from time to time.

A: 

Although I do not know if it supports shar files, I have found 7-Zip to be very effective at opening just about any kind of compression/archival formats. Its worth a try though.

heavyd
+1  A: 

A shar file is a SHell ARchive file. From The Linux Documentation Project -- file and archiving page,

Shell archiving utility. The text files in a shell archive are concatenated without compression, and the resultant archive is essentially a shell script, complete with #!/bin/sh header, containing all the necessary unarchiving commands, as well as the files themselves. Shar archives still show up in Usenet newsgroups, but otherwise shar has been replaced by tar/gzip. The unshar command unpacks shar archives.

The mailshar command is a Bash script that uses shar to concatenate multiple files into a single one for e-mailing. This script supports compression and uuencoding.

I love 7-zip, but i am not sure it can handle a shar file; will check if possible.
But, since it is a archive attached to a shell script,
you need to,

  1. cut out the archive part
  2. recognize the archive format
  3. use a corresponding tool to extract file (7-zip should work fine for this)

And, there is a Perl technique to do this.

Look at How do Linux binary installers (.bin, .sh) work? for some more on this.


While I talk of linux and tools here, you really do not need a Unix environment.
Perl is available on many platforms -- look at ActivePerl for example.
You can use simple installations of Cygwin, UnixUtils or, similar tools on your windows platform too.
And, 7-zip is available across all these platforms -- that's the best part of 7-zip.

nik
+1  A: 

there's shareutils (GNU) for windows here

ghostdog74
A: 

Maybe there are any unshar utils because is like to make a shell interpreter.

but I solved my problem writing a little perl script that extracts the files using the cat or sed pattern and ignoring everything else.

Aragorn