0

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.

Aragorn
  • 843
  • 12
  • 25
  • 1
    Belongs on superuser.com, once that site is open. Since that's not an available reason for closing this yet, I've chosen "not programming related." I'll also point you at SharUtils, the name of the GNU package that does shar-related things. Google for "sharutils windows" to get a Windows port. – Rob Kennedy Jul 13 '09 at 04:32
  • the packages of sharutils are for creating them, I want to extract the files without the need to install a mini *nix environment something like a http://www.t-st.org/untgz_f.htm for tar files and I think is possible because the archives are created following a pattern. – Aragorn Jul 13 '09 at 05:32

3 Answers3

2

there's shareutils (GNU) for windows here

ghostdog74
  • 327,991
  • 56
  • 259
  • 343
1

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
    • recognize the archive format
    • 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.

Community
  • 1
  • 1
nik
  • 13,254
  • 3
  • 41
  • 57
0

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
  • 843
  • 12
  • 25