Re: (Adv Q) Get the first file name of a series of them
From: Ed Morton (morton_at_lsupcaemnt.com)
Date: 06/09/05
- Next message: Icarus Sparry: "Re: (Adv Q) Get the first file name of a series of them"
- Previous message: * Tong *: "(Adv Q) Get the first file name of a series of them"
- In reply to: * Tong *: "(Adv Q) Get the first file name of a series of them"
- Next in thread: * Tong *: "Re: (Adv Q) Get the first file name of a series of them"
- Reply: * Tong *: "Re: (Adv Q) Get the first file name of a series of them"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 09 Jun 2005 11:35:31 -0500
* Tong * wrote:
> Hi,
>
> Suppose that I a bunch of split zip or rar file groups. I want to get the
> first one of each of them. I came up with a solution, As you can
> see, it is pretty ugly, I'm wondering if there is any simpler solution to
> it.
>
> Here is how I did it:
>
> $ ls | tee /tmp/temp.$$
<snip>
> $ cat /tmp/temp.$$ | tac | sed 'h; s/[0-9]*\....$//; G; s/\n/\t/;' | sed '$!N; /^\(.*\)\t.*\n\1\t/!P; D' | awk '{print $2}'
<snip>
$ ls | awk '{n=$0;sub(/.\.zip/,"",n)}!f[n]++'
ag-2248a.zip
csstsev1.zip
ecltse10.zip
tbedae21.zip
zads38e1.zip
zmis7151.zip
zmpf6141.zip
zvs91081.zip
Regards,
Ed.
- Next message: Icarus Sparry: "Re: (Adv Q) Get the first file name of a series of them"
- Previous message: * Tong *: "(Adv Q) Get the first file name of a series of them"
- In reply to: * Tong *: "(Adv Q) Get the first file name of a series of them"
- Next in thread: * Tong *: "Re: (Adv Q) Get the first file name of a series of them"
- Reply: * Tong *: "Re: (Adv Q) Get the first file name of a series of them"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|