* [Comm] echo "две переменные"
@ 2004-09-15 12:53 Dolgov OV
2004-09-15 13:02 ` Dolgov OV
2004-09-15 14:53 ` Maxim Bodynasky
0 siblings, 2 replies; 13+ messages in thread
From: Dolgov OV @ 2004-09-15 12:53 UTC (permalink / raw)
To: community
Здравствуйте.
Мозги себе уже вывернул, но немогу разобраться, как проделать следующее:
$ 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" печатает
поверх. Что у меня не так - понять не могу.
Натолкните на путь истинный, плиз.
Заранее благодарен.
--
С наилучшими,
Олег Долгов
<dov AT media-link DOT info>
Registered Linux user #315454
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Comm] echo "две переменные"
2004-09-15 12:53 [Comm] echo "две переменные" Dolgov OV
@ 2004-09-15 13:02 ` Dolgov OV
2004-09-15 14:53 ` Maxim Bodynasky
1 sibling, 0 replies; 13+ messages in thread
From: Dolgov OV @ 2004-09-15 13:02 UTC (permalink / raw)
To: community
On Wed, 15 Sep 2004 15:53:46 +0300
Dolgov OV <dov@media-link.info> wrote:
> Здравствуйте.
>
> Мозги себе уже вывернул, но немогу разобраться, как проделать
> следующее:
>
> $ 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" печатает
> поверх. Что у меня не так - понять не могу.
>
> Натолкните на путь истинный, плиз.
>
> Заранее благодарен.
--
С наилучшими,
Олег Долгов
<dov AT media-link DOT info>
Registered Linux user #315454
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Comm] echo "две переменные"
2004-09-15 12:53 [Comm] echo "две переменные" Dolgov OV
2004-09-15 13:02 ` Dolgov OV
@ 2004-09-15 14:53 ` Maxim Bodynasky
2004-09-15 15:04 ` Dolgov OV
1 sibling, 1 reply; 13+ messages in thread
From: Maxim Bodynasky @ 2004-09-15 14:53 UTC (permalink / raw)
To: community
Как-то это было написано 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: напишите, пожалуйста, в личку, если удасться решить :-(
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Comm] echo "две переменные"
2004-09-15 14:53 ` Maxim Bodynasky
@ 2004-09-15 15:04 ` Dolgov OV
2004-09-15 15:23 ` Maxim Bodynasky
0 siblings, 1 reply; 13+ messages in thread
From: Dolgov OV @ 2004-09-15 15:04 UTC (permalink / raw)
To: community
On Wed, 15 Sep 2004 18:53:15 +0400
Maxim Bodynasky <maximbo@rambler.ru> wrote:
> теперь мозги вывернул и я :-(
> ну не хочет у меня подобная ситуация воспроизводится, никак.
> Пишу в каталоге с кучей однотипных html:
>
> $ for i in *.html; do n=`grep ^"<TITLE>" $i | sed s/"<TITLE>"// - |
> sed s/"<\/TITLE>"// -`; echo "$i - $n"; done
>
> и всё прекрасно работает!
echo $n - $i
Именно в таком порядке, сначала текстовая переменная (во загнул), а
потом значение порядкового номера $i
>
> могу только предложить использовать perl:
> perl -nwe 'print "$ARGV - $1\n" if /^НАЗВАНИЕ - (.*)<br>/' *.html
Ну тут (в perl в смысле) я полный ноль :-( , к сожалению.
>
> так, IMHO, и проще и быстрее...
>
> PS: напишите, пожалуйста, в личку, если удасться решить :-(
--
С наилучшими,
Олег Долгов
<dov AT media-link DOT info>
Registered Linux user #315454
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Comm] echo "две переменные"
2004-09-15 15:04 ` Dolgov OV
@ 2004-09-15 15:23 ` Maxim Bodynasky
2004-09-15 17:14 ` Alexandr Leutin
0 siblings, 1 reply; 13+ messages in thread
From: Maxim Bodynasky @ 2004-09-15 15:23 UTC (permalink / raw)
To: community
Как-то это было написано Dolgov OV:
> On Wed, 15 Sep 2004 18:53:15 +0400
> Maxim Bodynasky <maximbo@rambler.ru> wrote:
> > теперь мозги вывернул и я :-(
> > ну не хочет у меня подобная ситуация воспроизводится, никак.
> > Пишу в каталоге с кучей однотипных html:
> >
> > $ for i in *.html; do n=`grep ^"<TITLE>" $i | sed s/"<TITLE>"// - |
> > sed s/"<\/TITLE>"// -`; echo "$i - $n"; done
> >
> > и всё прекрасно работает!
>
> echo $n - $i
> Именно в таком порядке, сначала текстовая переменная (во загнул), а
> потом значение порядкового номера $i
а какая разница?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Comm] echo "две переменные"
2004-09-15 15:23 ` Maxim Bodynasky
@ 2004-09-15 17:14 ` Alexandr Leutin
2004-09-16 6:56 ` Dolgov OV
0 siblings, 1 reply; 13+ messages in thread
From: Alexandr Leutin @ 2004-09-15 17:14 UTC (permalink / raw)
To: community
On Wed, Sep 15, 2004 at 07:23:27PM +0400, Maxim Bodynasky wrote:
> Как-то это было написано Dolgov OV:
> > On Wed, 15 Sep 2004 18:53:15 +0400
> > Maxim Bodynasky <maximbo@rambler.ru> wrote:
> > > теперь мозги вывернул и я :-(
> > > ну не хочет у меня подобная ситуация воспроизводится, никак.
> > > Пишу в каталоге с кучей однотипных html:
> > >
> > > $ for i in *.html; do n=`grep ^"<TITLE>" $i | sed s/"<TITLE>"// - |
> > > sed s/"<\/TITLE>"// -`; echo "$i - $n"; done
> > >
> > > и всё прекрасно работает!
> >
> > echo $n - $i
> > Именно в таком порядке, сначала текстовая переменная (во загнул), а
> > потом значение порядкового номера $i
>
> а какая разница?
$i здесь принимает значение "file1.html\n", т.е. с переводом
строки. Ваше echo выдает аргументы в одну строку, т.е. сначала
печатает file1.html\n, возвращается на предыдущую строку и
печатает $n (с начала строки).
--
Леутин Александр
Жизнь -- смертельно интересная штука!
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Comm] echo "две переменные"
2004-09-15 17:14 ` Alexandr Leutin
@ 2004-09-16 6:56 ` Dolgov OV
2004-09-16 7:39 ` Alexandr Leutin
0 siblings, 1 reply; 13+ messages in thread
From: Dolgov OV @ 2004-09-16 6:56 UTC (permalink / raw)
To: community
On Wed, 15 Sep 2004 23:14:11 +0600
Alexandr Leutin <leutin-lists@rambler.ru> 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
- 1ам Руссо - Далеко Далеко
- 2ам Руссо - Любовь которой Больше Нет
- 3емия - Зараза
.......
--
С наилучшими,
Олег Долгов
<dov AT media-link DOT info>
Registered Linux user #315454
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Comm] echo "две переменные"
2004-09-16 6:56 ` Dolgov OV
@ 2004-09-16 7:39 ` Alexandr Leutin
2004-09-16 8:11 ` Dolgov OV
0 siblings, 1 reply; 13+ messages in thread
From: Alexandr Leutin @ 2004-09-16 7:39 UTC (permalink / raw)
To: community
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 так.
--
Леутин Александр
Жизнь -- смертельно интересная штука!
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Comm] echo "две переменные"
2004-09-16 7:39 ` Alexandr Leutin
@ 2004-09-16 8:11 ` Dolgov OV
2004-09-16 11:46 ` Alexandr Leutin
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Dolgov OV @ 2004-09-16 8:11 UTC (permalink / raw)
To: community
On Thu, 16 Sep 2004 13:39:49 +0600
Alexandr Leutin <leutin-lists@rambler.ru> wrote:
> 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 так.
$ for ((i=1; i<787; i++)) ; do n=`grep ^НАЗВАНИЕ $i.html | sed
s/"НАЗВАНИЕ\ \-\ "// - | sed -e "s/\n//g" -` ; echo -n $n ; echo -$i;
done
-1раам Руссо - Далеко Далеко <br>
-2раам Руссо - Любовь которой Больше Нет <br>
-3адемия - Зараза <br>
.....
Результат тотже, только еще и <br> остался :-(
Может есть другой способ? Надо получить текстовый файл со списком в
алфавитном порядке: "Название из .html" - "номер этого .html"
--
С наилучшими,
Олег Долгов
<dov AT media-link DOT info>
Registered Linux user #315454
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Comm] echo "две переменные"
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
2 siblings, 1 reply; 13+ messages in thread
From: Alexandr Leutin @ 2004-09-16 11:46 UTC (permalink / raw)
To: community
On Thu, Sep 16, 2004 at 11:11:36AM +0300, Dolgov OV wrote:
> On Thu, 16 Sep 2004 13:39:49 +0600
> Alexandr Leutin <leutin-lists@rambler.ru> wrote:
>
> > 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 так.
>
> $ for ((i=1; i<787; i++)) ; do n=`grep ^НАЗВАНИЕ $i.html | sed
> s/"НАЗВАНИЕ\ \-\ "// - | sed -e "s/\n//g" -` ; echo -n $n ; echo -$i;
> done
> -1раам Руссо - Далеко Далеко <br>
> -2раам Руссо - Любовь которой Больше Нет <br>
> -3адемия - Зараза <br>
> .....
>
> Результат тотже, только еще и <br> остался :-(
Попробуйте
for ((i=1; i<787; i++)) ; do echo `grep ^НАЗВАНИЕ $i.html | sed
s/"НАЗВАНИЕ\ \-\ "// - | sed -e "s/\<br\>//" - $i; done
:)
> Может есть другой способ? Надо получить текстовый файл со списком в
> алфавитном порядке: "Название из .html" - "номер этого .html"
Способов что-то сделать всегда больше одного :)
--
Леутин Александр
Жизнь -- смертельно интересная штука!
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Comm] echo "две переменные"
2004-09-16 11:46 ` Alexandr Leutin
@ 2004-09-16 12:14 ` Dolgov OV
0 siblings, 0 replies; 13+ messages in thread
From: Dolgov OV @ 2004-09-16 12:14 UTC (permalink / raw)
To: community
On Thu, 16 Sep 2004 17:46:32 +0600
Alexandr Leutin <leutin-lists@rambler.ru> wrote:
> Попробуйте
> for ((i=1; i<787; i++)) ; do echo `grep ^НАЗВАНИЕ $i.html | sed
> s/"НАЗВАНИЕ\ \-\ "// - | sed -e "s/\<br\>//" - $i; done
> :)
Я так понимаю после последнего sed пропущен символ "`".
Но все равно не получилось, опять накладывается " - 'значение $i'"
поверх текста названия.
--
С наилучшими,
Олег Долгов
<dov AT media-link DOT info>
Registered Linux user #315454
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Comm] echo "две переменные"
2004-09-16 8:11 ` Dolgov OV
2004-09-16 11:46 ` Alexandr Leutin
@ 2004-09-16 11:47 ` Alexandr Leutin
2004-09-16 12:04 ` Dolgov OV
2 siblings, 0 replies; 13+ messages in thread
From: Alexandr Leutin @ 2004-09-16 11:47 UTC (permalink / raw)
To: community
On Thu, Sep 16, 2004 at 11:11:36AM +0300, Dolgov OV wrote:
> On Thu, 16 Sep 2004 13:39:49 +0600
> Alexandr Leutin <leutin-lists@rambler.ru> wrote:
>
> > 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 так.
>
> $ for ((i=1; i<787; i++)) ; do n=`grep ^НАЗВАНИЕ $i.html | sed
> s/"НАЗВАНИЕ\ \-\ "// - | sed -e "s/\n//g" -` ; echo -n $n ; echo -$i;
> done
> -1раам Руссо - Далеко Далеко <br>
> -2раам Руссо - Любовь которой Больше Нет <br>
> -3адемия - Зараза <br>
> .....
>
> Результат тотже, только еще и <br> остался :-(
Попробуйте
for ((i=1; i<787; i++)) ; do echo `grep ^НАЗВАНИЕ $i.html | sed
s/"НАЗВАНИЕ\ \-\ "// - | sed -e "s/\<br\>//" - $i; done
:)
> Может есть другой способ? Надо получить текстовый файл со
> списком в
> алфавитном порядке: "Название из .html" - "номер этого .html"
Способов что-то сделать всегда больше одного :)
--
Леутин Александр
Жизнь -- смертельно интересная штука!
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Comm] echo "две переменные"
2004-09-16 8:11 ` Dolgov OV
2004-09-16 11:46 ` Alexandr Leutin
2004-09-16 11:47 ` Alexandr Leutin
@ 2004-09-16 12:04 ` Dolgov OV
2 siblings, 0 replies; 13+ messages in thread
From: Dolgov OV @ 2004-09-16 12:04 UTC (permalink / raw)
To: community
On Thu, 16 Sep 2004 11:11:36 +0300
Dolgov OV <dov@media-link.info> wrote:
> Может есть другой способ? Надо получить текстовый файл со списком в
> алфавитном порядке: "Название из .html" - "номер этого .html"
>
Все. Вроде сделал. Спасибо Maxim Bodynasky. Помог его рецепт с perl. Я
только поменял местами значения после print - получилось как раз то, что
хотел.
n=`perl -nwe 'print "$1 - $ARGV\n" if /^НАЗВАНИЕ - (.*)<br>/' $i.html |
целая пачка sed'ов`; echo $n
Вроде нормально отработал. Правда по непонятной причине два файла тупо
пропустил, типа не нашел необходимого содержимого. Я проверил grep'ом,
вроде все как у всех, ну да ладно.
--
С наилучшими,
Олег Долгов
<dov AT media-link DOT info>
Registered Linux user #315454
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2004-09-16 12:14 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-15 12:53 [Comm] echo "две переменные" 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
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
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