From: "Dmytro O. Redchuk" <dor@ldc.net> To: community@altlinux.ru Subject: Re: [Comm] таблица замен в текстовом файле Date: Thu, 7 Jul 2005 12:02:10 +0300 Message-ID: <20050707090210.GO6054@ldc.net> (raw) In-Reply-To: <daipnl$s52$1@sea.gmane.org> On Thu, Jul 07, 2005 at 03:39:48PM +0700, Andrei Lomov wrote: > > Есть таблица замен, которые нужно сделать в текстовом файле: > в первой колонке заменяемые последовательности символов, > во второй колонке на что заменять. > > Какими средствамм наиболее просто такие замены реализуются > (sed, awk, .. ?) > > Дайте, пожалуйста, направление копания В самом общем случае я бы предложил не "sed, awk, .. ?", а "Python, Perl, .. ?", так как -- в самом общем случае Ж) -- символы надо как-то маскИровать. У sed, awk могут быть проблемы со спецсимволами, я думаю. Но их можно пытаться обходить :-) Если таких проблем не предвидится (хотя "как это -- не предвидится?"), то вариантов -- навскидку -- несколько. Можно одним скриптом сделать скрипт для sed вида: # s/foo_from_first_column/bar_from_second_one/ .... Можно awkом... Можно hash даже Ж-) -- и tr в скрипте... Но это всё очень расплывчато -- для "самого общего случая" (с) и "навскидку" (c;-). > > -- > Всего доброго, > А.Л. -- _,-=._ /|_/| `-.} `=._,.-=-._., @ @._, `._ _,-. ) _,.-' ` G.m-"^m`m' Dmytro O. Redchuk
next prev parent reply other threads:[~2005-07-07 9:02 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-07-07 8:39 Andrei Lomov 2005-07-07 9:02 ` Dmytro O. Redchuk [this message] 2005-07-08 9:11 ` Alexey Rusakov
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=20050707090210.GO6054@ldc.net \ --to=dor@ldc.net \ --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