Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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
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

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 browsing the Monastery: (7)
As of 2015-07-29 05:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls