in reply to Re^2: database sorter script
in thread database sorter script

Assuming it is relatively small and unsorted by default:

#!/usr/bin/perl -w my $db = '/some/file'; my $letter = 'Y'; open DB, $db or die "Can't read $db: $!\n"; my @matches; while(<DB>){ push @matches, $_ if m/^$letter/i; } close DB; print sort @matches;

Or more succinctly on *nix:

$ grep -i -e ^Y db.file | sort

cheers

tachyon

Replies are listed 'Best First'.
Re^4: database sorter script
by santander (Acolyte) on Dec 06, 2004 at 13:09 UTC
    To be more detail, database contain near 9000 records; top part contains some 'digital' names, then goes a normal alphabet.
    example:

    666
    666
    Active
    040 Feat Erica Baxter
    16B
    2 Brothers On The 4th Floor
    2 Eivissa
    2 Unlimited
    20 Fingers
    2Pac
    3-O-Matic
    4 Clubbers
    4-2 The Floor
    60 Minute Man
    A Trance Communications Classic
    A. Kay B.J.
    A.D.A.M. Feat. Amy
    A1
    Aaliyah
    AB Logic
    ABBA
    Above and Beyond
    Accela