ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Alexander Kuprin <ru_classic@gts.lg.ua>
To: community@altlinux.ru
Subject: Re: [Comm] Имена файлов.
Date: Wed, 14 Apr 2004 08:22:50 +0300
Message-ID: <200404140822.50922.ru_classic@gts.lg.ua> (raw)
In-Reply-To: <20040414045557.GB4040@abr.tool.ru>

On Wednesday 14 April 2004 07:55, Andrey Brindeew wrote:
> On Wed, Apr 14, 2004 at 10:31:22AM +0700, Yevgeny Manyashev wrote:
> > Имеются zip-архивы, сделанные в винде, с русскими именами файлов.
> > Вопрос: как перекодировать эти имена в koi8?
> > Команда
> > unzip -l 01.zip | iconv -f CP866 -t koi8
> >
> > сразу же обламывается.
>
> Почитай какую-нибудь детскую книжку по Юниксам.

Например, вот эту http://www.linux.org.ru/books/LDP/lug.html
Хотя ей уже 10 лет, но для общего ознакомления подойдёт. По крайней мере та 
часть, что относится не к "иксам".

> unzip у тебя пишет на диск, а iconv ждет от него данные на STDIN.

Но задачка интересная. Я попробовал её решить, использя find, но создать  
однострочник не вышло. :-\ Сперва я проверил такую конструкцию:

find *.doc -exec echo '{}' | iconv -f cp866 -t koi8-r ';' 

Работает. Потом решил усложнить

find *doc -exec mv -i '{}' `echo '{}' | iconv -f cp866 -t koi8-r` ';'

Не заработало. Не выполняется подстановка нового имени файла из 
`echo '{}' | iconv -f cp866 -t koi8-r`. В конце концов написал маленький 
скрипт dos2koi:

#!/bin/sh
mv $1 `echo $1 | iconv -f cp866 -t koi8-r`

который и вызывал при помощи find:

find *doc -exec ./dos2koi '{}' ';'

Так работает. Возможно я чего-то не знаю о find? Кто-нибудь может подсказать 
как подобную конструкцию реализовать одной строкой?

--
WBR, Alexadner Kuprin

  reply	other threads:[~2004-04-14  5:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-14  3:31 Yevgeny Manyashev
2004-04-14  4:55 ` Andrey Brindeew
2004-04-14  5:22   ` Alexander Kuprin [this message]
2004-04-14  5:40     ` Re[2]: " Sergey A. Kolesnitchenko
2004-04-14  5:23   ` Maxim.Savrilov
2004-04-14  5:30     ` Alexander Kuprin
2004-04-14  5:49       ` Maxim.Savrilov
2004-04-14  6:45 ` BSW

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=200404140822.50922.ru_classic@gts.lg.ua \
    --to=ru_classic@gts.lg.ua \
    --cc=community@altlinux.ru \
    /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

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git