<?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=23039&amp;type=atom" />
	<updated>2012-06-28T07:20:55Z</updated>
	<generator>PunBB</generator>
	<id>https://linuxforum.ru/viewtopic.php?id=23039</id>
		<entry>
			<title type="html"><![CDATA[Re: Помогите с заменой слова в строке...]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=284643#p284643" />
			<content type="html"><![CDATA[<p>Всем большое спасибо, особенно Fat-Zer, тему считаю закрытой...</p>]]></content>
			<author>
				<name><![CDATA[DECAL]]></name>
				<uri>https://linuxforum.ru/profile.php?id=7482</uri>
			</author>
			<updated>2012-06-28T07:20:55Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=284643#p284643</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Помогите с заменой слова в строке...]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=284581#p284581" />
			<content type="html"><![CDATA[<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"><br />lupo@gentoo-laptop /tmp % cat test.txt&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [gentoo-laptop][22:51]<br />#l# 1284725281 150000<br />lupo@gentoo-laptop /tmp % awk &#039;{print $3&quot; &quot;$2&quot; &quot;$1}&#039; test.txt&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[gentoo-laptop][22:52]<br />150000 1284725281 #l#<br /></div></p>]]></content>
			<author>
				<name><![CDATA[Lupo Alberto]]></name>
				<uri>https://linuxforum.ru/profile.php?id=9018</uri>
			</author>
			<updated>2012-06-27T19:52:33Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=284581#p284581</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Помогите с заменой слова в строке...]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=284576#p284576" />
			<content type="html"><![CDATA[<p>если третье слово последнее и после него нет пробелов, то можно проще<br />sed &#039;s/[^ ]*$/1/&#039;</p>]]></content>
			<author>
				<name><![CDATA[moshell]]></name>
				<uri>https://linuxforum.ru/profile.php?id=20870</uri>
			</author>
			<updated>2012-06-27T19:44:10Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=284576#p284576</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Помогите с заменой слова в строке...]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=284518#p284518" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>DECAL пишет:</cite><blockquote><p>Объясни если можно, что эта строка значит...Я так понял: -r   -   включить использование регулярных выражений</p></blockquote></div><p>расширенных регулярных выражений - не надо ставить тучу слешей перед скобками... да, ЕМНИП это расширение гнутой версии...<br /></p><div class="quotebox"><cite>DECAL пишет:</cite><blockquote><p>s/(#l# [0-9]{10}) [0-9]+   -   заменить #l# и десять разных цифр и одну любую цифру или больше на ...</p></blockquote></div><p>да, всё так.<br /></p><div class="quotebox"><cite>DECAL пишет:</cite><blockquote><p>а вот дальше не понял почему \1 1/</p></blockquote></div><p>\1 - ссылка на выражение в первых круглых скобках, т.е. на то, что соответствовало &#039;(#l# [0-9]{10})&#039; в исходной строке.</p>]]></content>
			<author>
				<name><![CDATA[Fat-Zer]]></name>
				<uri>https://linuxforum.ru/profile.php?id=11911</uri>
			</author>
			<updated>2012-06-27T14:59:11Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=284518#p284518</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Помогите с заменой слова в строке...]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=284505#p284505" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Fat-Zer пишет:</cite><blockquote><p>sed -r &#039;s/(#l# [0-9]{10}) [0-9]+/\1 1/&#039;</p></blockquote></div><p>Объясни если можно, что эта строка значит...<br />Я так понял: <br />-r&nbsp; &nbsp;-&nbsp; &nbsp;включить использование регулярных выражений<br />s/(#l# [0-9]{10}) [0-9]+&nbsp; &nbsp;-&nbsp; &nbsp;заменить #l# и десять разных цифр и одну любую цифру или больше на ... а вот дальше не понял почему \1 1/</p>]]></content>
			<author>
				<name><![CDATA[DECAL]]></name>
				<uri>https://linuxforum.ru/profile.php?id=7482</uri>
			</author>
			<updated>2012-06-27T14:19:40Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=284505#p284505</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Помогите с заменой слова в строке...]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=284498#p284498" />
			<content type="html"><![CDATA[<p>sed -r &#039;s/(#l# [0-9]{10}) [0-9]+/\1 1/&#039;</p>]]></content>
			<author>
				<name><![CDATA[Fat-Zer]]></name>
				<uri>https://linuxforum.ru/profile.php?id=11911</uri>
			</author>
			<updated>2012-06-27T13:52:52Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=284498#p284498</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Помогите с заменой слова в строке...]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=284493#p284493" />
			<content type="html"><![CDATA[<p>Пишу скрипт и я не могу сообразить как поменять третье слово (150000) на &quot;1&quot; в строке: <br /></p><div class="codebox"><pre><code>#l# 1284725281 150000</code></pre></div><p>учитывая, что третье слово может быть разной длиной, а второе всегда одинаковой, но с разными цифрами</p><p>Я примерно вот так начал писать, а дальше не соображу:<br /></p><div class="codebox"><pre><code>sed &#039;s/^#l#\ [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\ /#l#\ &quot;вот тут уже не соображу&quot;&#039; ahistory.dat</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DECAL]]></name>
				<uri>https://linuxforum.ru/profile.php?id=7482</uri>
			</author>
			<updated>2012-06-27T13:37:21Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=284493#p284493</id>
		</entry>
</feed>
