ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Yura Kalinichenko <yuk@iceb.vinnitsa.com>
To: AltLinux Community Maillist <community@altlinux.ru>
Subject: Re: [Comm] sed -?
Date: 05 Oct 2004 21:39:22 +0300
Message-ID: <1097001561.2851.29.camel@iceb> (raw)
In-Reply-To: <20041005181904.6329d878.dov@media-link.info>

В Вто, 05.10.2004, в 18:19, Dolgov OV написал:
> On Tue, 5 Oct 2004 16:43:09 +0300
> Dolgov OV <dov@media-link.info> wrote:
> > Здравствуйте.
> > 
> > Подскажите плз. как sed'ом заменить некий patern переводом строки?
> > Или может не sed'ом, а perl'ом, но задача вот в чем:
> > Есть текстовый файл с фрагментами html кода. В каждой строке от 1-го
> > до 30-ти участков, разделенных последовательностью </TD></tr>
> > Вот эти </TD></tr> я и хочу заменить переводом строки, дабы уже потом
> > обрабатывать каждую отдельную ячейку, как отдельную строку в файле.
> > 
> > Пробовал 
> > cat list.txt | sed s/"<\/TD><\/tr>"/\n/g - > list1.txt
> > тупо подставляется n.
> > 
> > perl -nwe 'print "$1\n" if /(.*)<\/TD><\/tr>/' list.txt >
> > list1.txt
> > отбрасывает только последнюю последовательность. Может можно както
> > perl'у объяснить чтобы он шел последовательно по строке до искомого
> > patern'а?
> 
> Как это ни печально, но пришлось воспользоваться услугами M$Word и его
> функцией найти и заменить </TD></tr> на ^p (знак абзаца) :-\

Мда... И это все вместо элементарного:

sed -e 's:</TD></tr>:\
:g' list.txt > list1.txt

Не говоря уже о том, что поиск с заменой может делать _любой_ текстовый
редактор в Linux, обладающий большей функциональностью, чем cat.

Hint: если хотите чему-то научиться путем в Unix-way - забудьте про Word
для таких случаев, заставляйте себя находить правильные решения - это
окупится.

-- 
Yura Kalinichenko



  reply	other threads:[~2004-10-05 18:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-05 13:43 Dolgov OV
2004-10-05 13:07 ` Aleksander N. Gorohovski
2004-10-05 14:27   ` Dolgov OV
2004-10-05 15:18     ` Michael Holzman
2004-10-06  8:14     ` Denis A. Yurashkou
2004-10-06 14:19     ` Aleksander N. Gorohovski
2004-10-05 15:19 ` Dolgov OV
2004-10-05 18:39   ` Yura Kalinichenko [this message]
2004-10-06  6:58     ` Dolgov OV
2004-10-06  7:36       ` Yura Kalinichenko
2004-10-06  8:15         ` Dolgov OV

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=1097001561.2851.29.camel@iceb \
    --to=yuk@iceb.vinnitsa.com \
    --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