Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: database sorter script

by tachyon (Chancellor)
on Dec 06, 2004 at 12:36 UTC ( [id://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

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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://412637]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-19 21:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found