ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Alexandr Leutin <leutin-lists@rambler.ru>
To: community@altlinux.ru
Subject: Re: [Comm] echo "две переменные"
Date: Thu, 16 Sep 2004 13:39:49 +0600
Message-ID: <20040916073949.GA15653@elektronik.olimp.chelseti.ru> (raw)
In-Reply-To: <20040916095615.485747d3.dov@media-link.info>

On Thu, Sep 16, 2004 at 09:56:15AM +0300, Dolgov OV wrote:
> > > а какая разница?
> > $i здесь принимает значение "file1.html\n", т.е. с переводом
> > строки. Ваше echo выдает аргументы в одну строку, т.е. сначала
> > печатает file1.html\n, возвращается на предыдущую строку и
> > печатает $n (с начала строки).
> Я так понял, что у меня таже проблема.
> 
> $ for ((i=1; i<787; i++)) ; do n=`grep ^НАЗВАНИЕ $i.html | sed
> s/"НАЗВАНИЕ\ \-\ "// - | sed s/"<br>"// -` ; echo $i - $n ; done 
> 1 - Авраам Руссо - Далеко Далеко 
> 2 - Авраам Руссо - Любовь которой Больше Нет 
> 3 - Академия - Зараза
> .....
> Нормально отработал.
> А вот надо наоборот. Результат должен выглядеть так:
> 
> Авраам Руссо - Далеко Далеко - 1
> Авраам Руссо - Любовь которой Больше Нет - 2
> Академия - Зараза - 3
> и т.д.
> 
> $ for ((i=1; i<787; i++)) ; do n=`grep ^НАЗВАНИЕ $i.html | sed
> s/"НАЗВАНИЕ\ \-\ "// - | sed s/"<br>"// -` ; echo $n - $i ; done
>  - 1ам Руссо - Далеко Далеко
>  - 2ам Руссо - Любовь которой Больше Нет
>  - 3емия - Зараза
> ......
> 
> Тоесть надо убрать из переменной $n символ перевода строки? Как?
> 
> Попробовал двумя разными echo - первое с ключем -n (или я его
> неправильно понял?), не помогло.
> 
> $ for ((i=1; i<787; i++)) ; do n=`grep ^НАЗВАНИЕ $i.html | sed
> s/"НАЗВАНИЕ\ \-\ "// - | sed s/"<br>"// -` ; echo -n $n ; echo -$i; done

for ((i=1; i<787; i++)) ; do n=`grep ^НАЗВАНИЕ $i.html | sed
s/"НАЗВАНИЕ\ \-\ "// - | sed -e "s/\n//g" - ; echo -n $n ; echo -$i; done

Пробовали? <BR> - это в HTML так.


-- 
Леутин Александр
Жизнь -- смертельно интересная штука!


  reply	other threads:[~2004-09-16  7:39 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
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 [this message]
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=20040916073949.GA15653@elektronik.olimp.chelseti.ru \
    --to=leutin-lists@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