Jmkr <jmkrnet@email.cz> writes:
> I tested Phil's "sed" command in terminal like this (all one line -
> email splits it):
>
> L=cs_CZ.UTF-8; sed -n
> "/^${L%%_*}/"'{s/^[[:alpha:]]*;\([[:digit:]]\);.*/\1/p;q}' languagelist
>
> and it seemed to work - with "cs_CZ.UTF-8" locale it returned 2. But
> some locales still returned wrong level. After using a modified "sed"
> command I think I got it working even for locales like "zh_TW.UTF-8" or
> "nn_NO.UTF-8" etc.:
>
> L=zh_TW.UTF-8; sed -n "/^${L%%_*}/"'{s/^[A-Za-z_]*;\([0-9]\);.*/\1/p;q}'
> languagelist
>
> returns 3 and with "nn_NO.UTF-8" it returns 1. I guess "[[:alpha:]]"
> does not include "_".
Oh, I thought I'd tested that (and remember being surprised that
[:alpha:] had seemed to include '_', so I must have deceived myself
there somehow).
Anyway, well spotted :-)
Actually, given that we don't care what's in the first field at that
point, and it's already matched the start of the country code, I think
this ought to work as well:
"/^${L%%_*}/"'{s/^[^;]*;\([0-9]\);.*/\1/p;q}'
> Anyway it is a nice improvement doing all the work with one "sed"
> process compared to that "wild pipelined bunch of cutting greps and
> heads". So, thanks to what Phil "sed", I am now upgrading my version of
> the script to the "sed" approach:).
:-)
I just pushed that change here:
https://salsa.debian.org/philh/localechooser/-/commit/f4845f6c8bad1ca11886ea2cff94653aa25045bc
which (once the pipeline runs) should generate a new mini-iso for testing.
Cheers, Phil.
--
|)| Philip Hands [+44 (0)20 8530 9560] HANDS.COM Ltd.
|-| http://www.hands.com/ http://ftp.uk.debian.org/
|(| Hugo-Klemm-Strasse 34, 21075 Hamburg, GERMANY
Attachment:
signature.asc
Description: PGP signature