ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Maxim Bodynasky <maximbo@rambler.ru>
To: community@altlinux.ru
Subject: Re: [Comm] echo "две переменные"
Date: Wed, 15 Sep 2004 18:53:15 +0400
Message-ID: <20040915145315.GA28309@maximbo.istranet.ru> (raw)
In-Reply-To: <20040915155346.0764dc8c.dov@media-link.info>

Как-то это было написано Dolgov OV:
> Здравствуйте.
> 
> Мозги себе уже вывернул, но немогу разобраться, как проделать следующее:
> 
> $ i=5 ; n=привет ; echo $n - $i
> привет - 5
> 
> Получается так как надо, а вот чего хочется:
> 
> $ for i in *.html ; do n=`grep ^НАЗВАНИЕ $i | sed s/"НАЗВАНИЕ\ \-\ "// -
> | sed s/"<br>"// -` ; m='$n' ; echo "$n - $i" ; done
> 
>  - 100.htmlesias - Maybe
>  - 101.htmllesias - Escape
>  - 102.htmlce - Naughty Girl
> 
> Тоесть echo выдает содержание $n как бы фоном, а " - $i" печатает
> поверх. Что у меня не так - понять не могу.
> 
> Натолкните на путь истинный, плиз.

теперь мозги вывернул и я :-(
ну не хочет у меня подобная ситуация воспроизводится, никак.
Пишу в каталоге с кучей однотипных html:

$ for i in *.html; do n=`grep ^"<TITLE>" $i | sed s/"<TITLE>"// - | sed s/"<\/TITLE>"// -`; echo "$i - $n"; done

и всё прекрасно работает!

могу только предложить использовать perl:
perl -nwe 'print "$ARGV - $1\n" if /^НАЗВАНИЕ - (.*)<br>/' *.html

так, IMHO, и проще и быстрее...

PS: напишите, пожалуйста, в личку, если удасться решить :-(


  parent reply	other threads:[~2004-09-15 14:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-15 12:53 Dolgov OV
2004-09-15 13:02 ` Dolgov OV
2004-09-15 14:53 ` Maxim Bodynasky [this message]
2004-09-15 15:04   ` Dolgov OV
2004-09-15 15:23     ` Maxim Bodynasky
2004-09-15 17:14       ` Alexandr Leutin
2004-09-16  6:56         ` Dolgov OV
2004-09-16  7:39           ` Alexandr Leutin
2004-09-16  8:11             ` Dolgov OV
2004-09-16 11:46               ` Alexandr Leutin
2004-09-16 12:14                 ` Dolgov OV
2004-09-16 11:47               ` Alexandr Leutin
2004-09-16 12:04               ` 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=20040915145315.GA28309@maximbo.istranet.ru \
    --to=maximbo@rambler.ru \
    --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