古い記事
ランダムジャンプ
新しい記事

THE

2003-03-14-2
m3u ファイル (曲名リスト) のデータをアルファベット順に並び替えたい
のだが、"the" で始まるアーティスト名が「T」のところに来るのがうん
ざり。"the" を抜いてソートするプログラムを書いて対処。

#!/usr/bin/env perl
print map {$h{$_}} sort map {$t = $_; s/the_//i; $h{$_} = $t; $_} (<>);
これにより、以下のように "the beatles" が「B」始まりとしてソートさ
れた。やっほー!

/home/yto/mp3/art_blakey/a_night_at_birdland__volume_1/06-mayreh.mp3
/home/yto/mp3/art_blakey/a_night_at_birdland__volume_1/07-weedot.mp3
/home/yto/mp3/the_beatles/one/01-love_me_do.mp3
/home/yto/mp3/the_beatles/one/...
/home/yto/mp3/the_beatles/one/27-the_long_and_winding_road.mp3
/home/yto/mp3/bill_evans_trio/waltz_for_debby/01-my_foolish_heart.mp3
/home/yto/mp3/bill_evans_trio/waltz_for_debby/02-waltz_for_debby.mp3