summaryrefslogtreecommitdiffstats
path: root/convert
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-09-06 08:01:55 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-09-06 08:01:55 +0000
commit7a1fc72ee20d7426bf2d7f624b1ff55f875de9c7 (patch)
tree660f939ce0259d47701e6403d98aba3ee129b516 /convert
parent1b2c57eddee46de766d9671734b711a3183734ff (diff)
downloadldetect-lst-7a1fc72ee20d7426bf2d7f624b1ff55f875de9c7.tar
ldetect-lst-7a1fc72ee20d7426bf2d7f624b1ff55f875de9c7.tar.gz
ldetect-lst-7a1fc72ee20d7426bf2d7f624b1ff55f875de9c7.tar.bz2
ldetect-lst-7a1fc72ee20d7426bf2d7f624b1ff55f875de9c7.tar.xz
ldetect-lst-7a1fc72ee20d7426bf2d7f624b1ff55f875de9c7.zip
nicely sort MonitorsDB (needed by XFdrake):
have "Flat Panel 800x600" before "Flat Panel 1024x768"
Diffstat (limited to 'convert')
-rwxr-xr-xconvert/sort_MonitorsDB.pl18
1 files changed, 18 insertions, 0 deletions
diff --git a/convert/sort_MonitorsDB.pl b/convert/sort_MonitorsDB.pl
new file mode 100755
index 00000000..4cabedb3
--- /dev/null
+++ b/convert/sort_MonitorsDB.pl
@@ -0,0 +1,18 @@
+#!/usr/bin/perl
+
+use POSIX;
+use locale;
+$ENV{LC_COLLATE} || $ENV{LANG} or setlocale(LC_COLLATE, "fr_FR");
+
+my @l = <>;
+
+@l = map { $_->[1] } sort { $a->[0] cmp $b->[0] } map {
+ my $val = $_;
+ chomp;
+ s!^\s*(#.*|$)!!;
+ s!(;.*?);.*!$1!;
+ s/(\d+)/sprintf("%06d", $1)/e;
+ [ $_, $val ];
+} @l;
+
+print foreach @l;