Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
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

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?
[Eily]: hu, don't tell the other French people I never tried it, I might get kicked out :P
choroba . o O ( The Czech at-sign is also edible )
[Eily]: the French @ is a mouthful I guess...
[Eily]: choroba Wikipedia gives me Zavináč which doesn't seem to translate to something edible?
[Eily]: (yes I'm very good at using question marks, thank you)
[Discipulus]: O_O frexit for you! even me i tried. it was in the arabic quarter in Granada; they offered as 'tapas' in bars. I eataly somewhere they eat ;=P Sardinia a Pulia iirc
[choroba]: Zavináč
[Eily]: choroba oh, that makes sense :)

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2017-11-21 10:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (297 votes). Check out past polls.

    Notices?