Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: database sorter script

by tachyon (Chancellor)
on Dec 06, 2004 at 12:36 UTC ( #412637=note: print w/ replies, xml ) Need Help??


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


Comment on Re^3: database sorter script
Select or Download Code
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://412637]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2014-08-20 21:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (124 votes), past polls