From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7375 invoked from network); 28 Aug 2005 00:53:59 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 28 Aug 2005 00:53:59 -0000 Received: (qmail 76315 invoked from network); 28 Aug 2005 00:53:53 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 28 Aug 2005 00:53:53 -0000 Received: (qmail 6937 invoked by alias); 28 Aug 2005 00:53:40 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9351 Received: (qmail 6927 invoked from network); 28 Aug 2005 00:53:38 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 28 Aug 2005 00:53:37 -0000 Received: (qmail 75248 invoked from network); 28 Aug 2005 00:53:37 -0000 Received: from p548509e1.dip0.t-ipconnect.de (HELO solfire) (84.133.9.225) by a.mx.sunsite.dk with SMTP; 28 Aug 2005 00:53:32 -0000 Received: from localhost ([127.0.0.1]) by solfire with esmtp (Exim 4.42) id 1E9BSK-0007Cy-Ek; Sun, 28 Aug 2005 02:55:31 +0200 Date: Sun, 28 Aug 2005 02:55:28 +0200 (CEST) Message-Id: <20050828.025528.59463603.Meino.Cramer@gmx.de> To: schaefer@brasslantern.com Cc: zsh-users@sunsite.dk From: Meino Christian Cramer In-Reply-To: <1050827204440.ZM11639@candle.brasslantern.com> References: <20050826.183216.75189062.Meino.Cramer@gmx.de> <1050827204440.ZM11639@candle.brasslantern.com> X-Mailer: Mew version 4.1 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Rcpt-To: schaefer@brasslantern.com, zsh-users@sunsite.dk X-SA-Exim-Mail-From: Meino.Cramer@gmx.de Subject: Re: ${i:r}-question Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SA-Exim-Version: 4.1+cvs (built Sat, 28 Aug 2004 13:10:40 +0200) X-SA-Exim-Scanned: Yes (on solfire) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 From: Bart Schaefer Subject: Re: ${i:r}-question Date: Sat, 27 Aug 2005 20:44:40 +0000 Hi Bart , :) thanks for your reply ! :O) To "unbroke" my broken English a little bit more I will try to tell a little more of my (a little longish) "archiver/compressor"-story. p7zip is a data compressor, which has a compression ratio even better than bzip2 (!). Since "space" on my harddisk is a seldom guest, I was happy, that Oskar, the author of atool has implemented the "arepack" tool in addition to all the other very handy tools of his atool suit. In opposite to bzip2/gzip p7zip is able to build archives of more than one file. Since it originates in the Windows world, it does not reconstruct certain attributes like gid and uid of the files of such an p7zip-only-many-files archive. The author of p7zip recommends to make a tar archive first and then compress it with p7zip for backup purposes on Unix/Linux (which I use). The format of the commandline to feed into arepack is as follows: arepack -F -e For *.tar.gz archives it would be: arepack -F.tar.7z -e zsh-4.2.5.tar.gz but if you get a single file compressed with gzip for example, it would be: arepack -F.7z -e zsh-doc-4.2.5.gz Therefore I was looking for a zsh script expression -- without the need to use "big brothers" like sed, perl etc -- which simply gives me "the whole extension string" in one turn, without to destinguish between the 2-extension form like ".tar.gz" from the 1-extension-form like ".gz" in the script code itsself in beforehand. Additionally it would be nice, if the code would give me the information, whether it has found a 2- or an 1-extension form. Or shorter: Output: Input: +------> complete extension | -----> script ---+ | +------> info whether it is an 1- or 2-extension form The code fragment ${${(M)afile%%(.tar|).(7z|bz2|gz)}#.} would fail on files, which are of the pattern zsh-4.2.5-doc.bz2 (only one extension) or? (and all files, which are no Makefiles.... ;O) If I would have such an code fragment as desribed above, I would simply replace any ".tgz" string in a ".tar,gz" string afterwards (.tbz -> .tar.bz2 accordingly) and I would check for a ".tgz" string and then generate a ".tar.7z" string for the "-F part of the commandline to be fed into arepack. Dont hesitate to mail and ask again, Bart, if something is unclear -- English isn't my mother's tongue...sorry. Have a nice weekend and thank you very much for your help and patience with my English in advance ! :) Meino > On Aug 26, 6:32pm, Meino Christian Cramer wrote: > } > } I am currently wrting a little shell script, which encapsulates the > } new "arepack" addition of atool-0.31.0 (nice tool! use it! :O))). > > I'm glad you answered zzapper's question because I was scratching my > head over why it made a difference if the bzip'd file was also tar'd. > > } I am wondering, whether it would possible to strip off more than one > } "instance" of extension ("tar.bz2" instead of "bz2") from "$afile" > > You mean e.g. ${${(M)afile%%(.tar|).(7z|bz2|gz)}#.} except that you > don't want to have to enumerate (7z|bz2|gz)? Otherwise I'm not clear > on the question. > > Incidentally if it's important to know about the "tar" part, then have > you considered what to do with e.g. ".tgz" files? >