From: Kerin Millar <kerframil@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: [gentoo-user] Re: help renaming files
Date: Wed, 07 Apr 2010 20:01:41 +0100 [thread overview]
Message-ID: <hpikqn$nad$1@dough.gmane.org> (raw)
In-Reply-To: <20100407132123.5521f5ae@acme.acmenet>
On 07/04/2010 17:21, luis jure wrote:
>
> hello list.
>
> i have a bunch of files with accented characters in their names, both
> upper- and lower case. i want to rename them using the non-accented
> equivalent. i thought that would be easy to do using something like tr.
> big mistake. confronted with accented characters, tr outputs garbage.
>
> searching the web, i found this: "Although the tr command respects C
> locale environment variables, don't expect it to do anything sensible
> with UTF-8 documents, such as being able to replace lower-case accented
> characters with appropriate upper-case characters. The tr command works
> best with ASCII and the other standard C locales."
>
> i'm using es_UY.UTF8 and i can't make tr do anything useful.
It can be done with Perl. For example:
$ echo "El castellano es la lengua española oficial del Estado. Las
demás lenguas españolas serán también oficiales en las respectivas
Comunidades Autónomas" | perl -M'encoding utf8' -MUnicode::Normalize -pe
'$_=NFKD($_);s/\pM//og'
The following output should be seen:
El castellano es la lengua espanola oficial del Estado. Las demas
lenguas espanolas seran tambien oficiales en las respectivas Comunidades
Autonomas
Cheers,
--Kerin
next prev parent reply other threads:[~2010-04-07 19:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-07 16:21 [gentoo-user] help renaming files luis jure
2010-04-07 16:32 ` KH
2010-04-07 17:29 ` Jonas de Buhr
2010-04-07 19:01 ` Kerin Millar [this message]
2010-04-07 19:47 ` [gentoo-user] " luis jure
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='hpikqn$nad$1@dough.gmane.org' \
--to=kerframil@gmail.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox