<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Linux Forum &mdash; замена содержимого строки]]></title>
	<link rel="self" href="https://linuxforum.ru/extern.php?action=feed&amp;tid=36799&amp;type=atom" />
	<updated>2014-11-21T01:39:03Z</updated>
	<generator>PunBB</generator>
	<id>https://linuxforum.ru/viewtopic.php?id=36799</id>
		<entry>
			<title type="html"><![CDATA[Re: замена содержимого строки]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=432097#p432097" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Vascom пишет:</cite><blockquote><p>Можно же сразу сделать</p><p>sed -i</p></blockquote></div><p>а лучше<br /><div class="termtitle" style="font-family: sans-serif; position:relative; height:auto; width:auto; background:#3A4061; color:#FFFFFF; padding: 1px;"><b> Консоль:</b></div>
<div class="termcont" style="font-family: Terminus; position:relative; height:auto; width:auto; overflow-x:scroll; white-space: nowrap ; overflow-y:auto;background:#000000; color:#4EF44E; line-height:1.2; padding: 3px; font-size: 1rem; max-height: 60vh">sed&nbsp; -i*~</div><br />тогда sed&nbsp; делает бекап.<br /></p><div class="quotebox"><cite>Vascom пишет:</cite><blockquote><p>-e</p></blockquote></div><p>не нужно.</p>]]></content>
			<author>
				<name><![CDATA[drBatty]]></name>
				<uri>https://linuxforum.ru/profile.php?id=86</uri>
			</author>
			<updated>2014-11-21T01:39:03Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=432097#p432097</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: замена содержимого строки]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=432013#p432013" />
			<content type="html"><![CDATA[<p><strong>Vascom</strong>, супер! Спасибо, буду знать!</p>]]></content>
			<author>
				<name><![CDATA[sotariz]]></name>
				<uri>https://linuxforum.ru/profile.php?id=13164</uri>
			</author>
			<updated>2014-11-20T09:38:52Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=432013#p432013</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: замена содержимого строки]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=432012#p432012" />
			<content type="html"><![CDATA[<p>И на самом деле нет нужды создавать временный файл (да ещё и на диске), а затем заменять им основной. Можно же сразу сделать <br /></p><div class="codebox"><pre><code>sed -i -e &quot;s/$FOO/$BAR/&quot; $STD/$ZNAME</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Vascom]]></name>
				<uri>https://linuxforum.ru/profile.php?id=5339</uri>
			</author>
			<updated>2014-11-20T09:34:54Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=432012#p432012</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: замена содержимого строки]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=432011#p432011" />
			<content type="html"><![CDATA[<p><strong>Vascom</strong>, работаю с копиями<br />замеченные ошибки - опечатки при создании темы т.к. писал от руки</p><p><div class="termtitle" style="font-family: sans-serif; position:relative; height:auto; width:auto; background:#3A4061; color:#FFFFFF; padding: 1px;"><b> Консоль:</b></div>
<div class="termcont" style="font-family: Terminus; position:relative; height:auto; width:auto; overflow-x:scroll; white-space: nowrap ; overflow-y:auto;background:#000000; color:#4EF44E; line-height:1.2; padding: 3px; font-size: 1rem; max-height: 60vh">FOO=&quot;@&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3600 IN&nbsp; &nbsp; &nbsp; A&nbsp; &nbsp; &nbsp; &nbsp;IP&quot;<br />BAR=&quot;;@&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3600 IN&nbsp; &nbsp; &nbsp; A&nbsp; &nbsp; &nbsp; &nbsp;IP&quot;</p><p>sed sed &quot;s/$FOO/$BAR/&quot; $STD/$ZNAME &gt; $STD/$ZNAME~<br />mv $STD/$ZNAME~ $STD/$ZNAME</div></p><p>ошибка нашлась в <strong>sed</strong> sed... как сразу не заметил не знаю...<br />Спасибо!</p>]]></content>
			<author>
				<name><![CDATA[sotariz]]></name>
				<uri>https://linuxforum.ru/profile.php?id=13164</uri>
			</author>
			<updated>2014-11-20T09:31:29Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=432011#p432011</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: замена содержимого строки]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=432006#p432006" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>sed &quot;s/$STR/$STR2/&quot; file &gt; file.new</code></pre></div><p>Ты забыл поставить завершающий слеш. Тебе же об этом прямо русским языком в ошибке написано.</p><p>И переменная у тебя SRT2, а в sed ты вызываешь $STR2 (пустую переменную).</p><p>P.S. Сперва отладь скрипт где-нибудь, а то рискуешь испортить свои файлы.</p>]]></content>
			<author>
				<name><![CDATA[Vascom]]></name>
				<uri>https://linuxforum.ru/profile.php?id=5339</uri>
			</author>
			<updated>2014-11-20T09:02:06Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=432006#p432006</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[замена содержимого строки]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=432003#p432003" />
			<content type="html"><![CDATA[<p>Всем привет!<br />Ни как не могу сообразить... надо в куче файлов сменить содержимое определенной строки строки, файлы - файлы зон. Пробовал sed юзать, но толи лыжи не едут толи....</p><p><div class="termtitle" style="font-family: sans-serif; position:relative; height:auto; width:auto; background:#3A4061; color:#FFFFFF; padding: 1px;"><b> Консоль:</b></div>
<div class="termcont" style="font-family: Terminus; position:relative; height:auto; width:auto; overflow-x:scroll; white-space: nowrap ; overflow-y:auto;background:#000000; color:#4EF44E; line-height:1.2; padding: 3px; font-size: 1rem; max-height: 60vh">STR=&quot;@&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3600 IN&nbsp; &nbsp; &nbsp; A&nbsp; &nbsp; &nbsp; &nbsp;IP&quot;<br />SRT2=&quot;;@&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3600 IN&nbsp; &nbsp; &nbsp; A&nbsp; &nbsp; &nbsp; &nbsp;IP&quot;</p><p>sed &quot;s/$STR/$STR2&quot; file &gt; file.new</p><p>sed: -e выражение #1, символ 3: незавершенная команда `s&#039;</div></p><p>что ему не так? пробелы в строке? как выйти из ситуации, ибо файлов много и руками пройти все не вариант?..</p>]]></content>
			<author>
				<name><![CDATA[sotariz]]></name>
				<uri>https://linuxforum.ru/profile.php?id=13164</uri>
			</author>
			<updated>2014-11-20T08:47:33Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=432003#p432003</id>
		</entry>
</feed>
