[PLUG] Listing directory by families with same basename
Jason Dubrow
doobie@doobie.org
Sun, 8 Apr 2001 11:14:21 -0500 (EST)
Hangover? I never have hangovers anymore.
try the changes below,
not sure what you are trying to get at with printing the +++.
Jason
On Sun, 8 Apr 2001, Lev Gorenstein wrote:
> On Sun, 8 Apr 2001, Jason Dubrow wrote:
>
> JD> #!/usr/bin/perl
> JD>
> JD> @FILES = `ls`;
> JD>
> JD> foreach $file (@FILES) {
> JD> $file =~ s/\..*$//;
> JD> $family{$file} = 1;
> JD> }
> JD>
> JD> foreach $fam (keys %family) {
$fam =~ s/[\r\n]//g;
print "$fam\t";
$count++;
if ($count % 3 == 0) {
print "\n";
}
> JD> }
> JD>
> JD> that should work, but im a bit intoxicated right now...so i'm not 100%
> JD> sure
>
> Morning! (and may I wish you an easy hangover? ;-)
>
> Thank you for your help, Jason! Yes, it does work (except that \n
> is extra in the print statement). It'll be a nice and convenient
> tool in my toolbox except one little problem - it lists files in a
> single column. Thus it still suffers from the same thing that
> regular ls (too long of an output runs away from the screen). Is
> it possible to make it multicolumn? I'm using pretty long
> filenames, so there won't be more than 2 or 3 columns, but it's
> still 3 times fewer lines...
>
> Well, I know it *is* possible, the question is if it's something
> easy - or too complicated and not worth bothering? ;-)
>
> And one more question - how would I go about making it to print
> some sign (say, "+++") by the name of the families (as opposed to
> the names of single files in the same directory)?
>
>
> Thanks again,
> Lev
>
> --
> Growing older is mandatory... growing up is optional!
>
>
> ____________________________________________________
> The Purdue Linux Users' Group (PLUG) mailing list.
> For account maintenance, go to:
> plug mailing list - plug@csociety.purdue.edu
> http://csociety.ecn.purdue.edu/mailman/listinfo/plug
>