<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Linux Forum &mdash; Помогите написать скрипт на sed]]></title>
	<link rel="self" href="https://linuxforum.ru/extern.php?action=feed&amp;tid=22453&amp;type=atom" />
	<updated>2012-05-27T17:32:53Z</updated>
	<generator>PunBB</generator>
	<id>https://linuxforum.ru/viewtopic.php?id=22453</id>
		<entry>
			<title type="html"><![CDATA[Re: Помогите написать скрипт на sed]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=277554#p277554" />
			<content type="html"><![CDATA[<p>удалить две строки не сложно:<br />sed &#039;/^Text/{N;d}&#039;<br />а вот остановится после первого вхождения у меня кривовато получилось:<br />sed -n &#039;/^Text/{N;s/.*//;:loop n;p;s/.*//;b loop};p&#039;</p>]]></content>
			<author>
				<name><![CDATA[Fat-Zer]]></name>
				<uri>https://linuxforum.ru/profile.php?id=11911</uri>
			</author>
			<updated>2012-05-27T17:32:53Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=277554#p277554</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Помогите написать скрипт на sed]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=277543#p277543" />
			<content type="html"><![CDATA[<p>В линуксе не силен, но так как под винду отсутствуют утилита sed либо подобная, пришлось обратиться к ее портированному аналогу под винду, есть текстовый mif файл следующего содержания:</p><div class="codebox"><pre><code>Version 300
Charset &quot;WindowsCyrillic&quot;
Delimiter &quot;,&quot;
CoordSys NonEarth Units &quot;m&quot; Bounds (-9999,99, -9999,99) (9999,99, 9999,99)
Columns 1
  ID Integer
Data

Text
    &quot;Текст 1&quot;
Text
    &quot;Текст 1&quot;
    1111,11 1111,11 2222,22 2222,22
    Font (&quot;Arial Cyr&quot;,0,0,0)
    Angle 0,0000

Text
    &quot;Текст 2&quot;
Text
    &quot;Текст 2&quot;
    3333,33 3333,33 4444,44 4444,44
    Font (&quot;Arial Cyr&quot;,0,0,0)
    Angle 0,0000

.......

Text
    &quot;Текст N&quot;
Text
    &quot;Текст N&quot;
    NNNN,NN NNNN,NN NNNN,NN NNNN,NN
    Font (&quot;Arial Cyr&quot;,0,0,0)
    Angle 0,0000</code></pre></div><p>Необходимо удалить первую встречающуюся пару:<br /></p><div class="codebox"><pre><code>Text
    &quot;Текст _&quot;</code></pre></div><p>В результате чего текстовой файл должен принять следующий вид:</p><div class="codebox"><pre><code>Version 300
Charset &quot;WindowsCyrillic&quot;
Delimiter &quot;,&quot;
CoordSys NonEarth Units &quot;m&quot; Bounds (-9999,99, -9999,99) (9999,99, 9999,99)
Columns 1
  ID Integer
Data

Text
    &quot;Текст 1&quot;
    1111,11 1111,11 2222,22 2222,22
    Font (&quot;Arial Cyr&quot;,0,0,0)
    Angle 0,0000

Text
    &quot;Текст 2&quot;
    3333,33 3333,33 4444,44 4444,44
    Font (&quot;Arial Cyr&quot;,0,0,0)
    Angle 0,0000

.......

Text
    &quot;Текст N&quot;
    NNNN,NN NNNN,NN NNNN,NN NNNN,NN
    Font (&quot;Arial Cyr&quot;,0,0,0)
    Angle 0,0000</code></pre></div><p>В идеале еще бы строки Font и Angle поменять, но с этим я разобрался) А вот с удалением 2ух последовательных строк никак не могу... рассматриваю все варианты.<br />Отмечу что, количество строк одного блока Text и шапки, всегда остается неизменным, так что вариант удаления каждой Nной строки не исключен.</p>]]></content>
			<author>
				<name><![CDATA[komix74]]></name>
				<uri>https://linuxforum.ru/profile.php?id=23963</uri>
			</author>
			<updated>2012-05-27T16:45:17Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=277543#p277543</id>
		</entry>
</feed>
