Saratov Linux User Group
 help / color / mirror / Atom feed
From: Nickolay Parfenov <nik@eastsoft.ru>
To: sin.a@freeline.ru, Saratov Linux User Group Maillist <sarlug@lug.ru>
Subject: Re: [Sarlug] serach & replace
Date: Fri, 15 Aug 2003 10:21:33 -0000
Message-ID: <20030815101035.GA80785@rock.eastsoft.int> (raw)
Message-ID: <20030815102133.q2U-UTu3AQDzl_dCkW1HYt8hKInWVy6Glu2OyeF5MRs@z> (raw)
In-Reply-To: <200308151326.34347.sin.a@freeline.ru>

Hi, sinaps !
On Fri, Aug 15, 2003 at 01:26:34PM +0400, you wrote:
>  Есть большое количество файлов, их нужно просмотреть, и заменить
> "выражение1" на "выражение2". В "Linux Gazette на русском" недавно был
> Однострочник месяца на Perl, но разобратся с этим - я, увы, не смог :( .
> grep это нашел (в количестве - 140шт.), а с автоматической заменой -
> трудности...

>  В принципе строчку можно просто удалить, если html переживет без 
> <meta name=...  content=... >

В таких случаях вместо газет лучше читать классику типа Керниган, Пайк
"UNIX - универсальная среда программирования" (а лучше учить наизусть ;) и
man'ы. То же самое и с perl'ом, разбираться с ним не изучив grep, sed,
awk, ... значит просто тратить время. Ну а замену можно сделать, например,
из командной строки:
for f in *.html;do \
	sed 's/выр1/выр2/g'<$f >$f.new && mv $f $f.bak && mv $f.new $f;done

Для рекурсивной замены вместо for используй find с параметром -exec.

SY, Николай
-- 
   Nickolay N. Parfenov       (8452) 73-55-10 73-55-12      EastSoft Ltd.
   E-mail: nik (at) eastsoft.ru   FidoNet: 2:5053/44.1      UIN: 14602777


  parent reply	other threads:[~2003-08-15 10:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-15  9:26 sinaps
2003-08-15  9:26 ` sinaps
2003-08-15  9:58 ` Roman Bogorodskiy
2003-08-15  9:59   ` Roman Bogorodskiy
2003-08-15 10:11   ` Re[2]: " "Genix" 
2003-08-15 10:11     ` "Genix" 
2003-08-15 10:19     ` Roman Bogorodskiy
2003-08-15 10:20       ` Roman Bogorodskiy
2003-08-15 13:34       ` Roman Bogorodskiy
2003-08-15 13:34         ` Roman Bogorodskiy
2003-08-15 10:10 ` Nickolay Parfenov [this message]
2003-08-15 10:21   ` Nickolay Parfenov
2003-08-15 10:52   ` sinaps
2003-08-15 10:52     ` sinaps
2003-08-15 10:13 ` "Genix" 
2003-08-15 10:09   ` "Genix" 
2003-08-15 19:31 ` Paul P Komkoff Jr
2003-08-15 19:31   ` Paul P Komkoff Jr

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=20030815101035.GA80785@rock.eastsoft.int \
    --to=nik@eastsoft.ru \
    --cc=sarlug@lug.ru \
    --cc=sin.a@freeline.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

Saratov Linux User Group

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sarlug/0 sarlug/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 sarlug sarlug/ http://lore.altlinux.org/sarlug \
		sarlug@lists.lug.ru sarlug@lug.ru
	public-inbox-index sarlug

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


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