<?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=35222&amp;type=atom" />
	<updated>2014-06-17T08:32:10Z</updated>
	<generator>PunBB</generator>
	<id>https://linuxforum.ru/viewtopic.php?id=35222</id>
		<entry>
			<title type="html"><![CDATA[Re: Сортировать слова в строке]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=413224#p413224" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>-=Serj=- пишет:</cite><blockquote><div class="codebox"><pre><code> echo &quot;qwer abc 3 wert zxy&quot; | xargs -n1 | sort | xargs</code></pre></div></blockquote></div><p>Так ещё эстетичнее.</p>]]></content>
			<author>
				<name><![CDATA[Lupo Alberto]]></name>
				<uri>https://linuxforum.ru/profile.php?id=9018</uri>
			</author>
			<updated>2014-06-17T08:32:10Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=413224#p413224</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Сортировать слова в строке]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=413223#p413223" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code> echo &quot;qwer abc 3 wert zxy&quot; | xargs -n1 | sort | xargs</code></pre></div><div class="codebox"><pre><code>python -c &quot;print(&#039; &#039;.join(sorted(&#039;qwer abc 3 wert zxy&#039;.split())))&quot;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[-=Serj=-]]></name>
				<uri>https://linuxforum.ru/profile.php?id=16175</uri>
			</author>
			<updated>2014-06-17T08:20:49Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=413223#p413223</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Сортировать слова в строке]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=413216#p413216" />
			<content type="html"><![CDATA[<p>Да, так эстетичнее.</p>]]></content>
			<author>
				<name><![CDATA[Vascom]]></name>
				<uri>https://linuxforum.ru/profile.php?id=5339</uri>
			</author>
			<updated>2014-06-17T06:47:48Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=413216#p413216</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Сортировать слова в строке]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=413215#p413215" />
			<content type="html"><![CDATA[<p>Неужели трудно?<br /></p><div class="codebox"><pre><code>echo &quot;asd 123 rewt 567 897 hgd &quot; | sed &#039;s/\ /\n/g&#039; | sort | tr &#039;\n&#039; &#039; &#039;
 123 567 897 asd hgd rewt </code></pre></div>]]></content>
			<author>
				<name><![CDATA[Lupo Alberto]]></name>
				<uri>https://linuxforum.ru/profile.php?id=9018</uri>
			</author>
			<updated>2014-06-17T06:45:38Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=413215#p413215</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Сортировать слова в строке]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=413207#p413207" />
			<content type="html"><![CDATA[<p><strong>Vascom</strong>, спасибо, то, что надо.</p>]]></content>
			<author>
				<name><![CDATA[fragment]]></name>
				<uri>https://linuxforum.ru/profile.php?id=22441</uri>
			</author>
			<updated>2014-06-17T06:33:12Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=413207#p413207</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Сортировать слова в строке]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=413206#p413206" />
			<content type="html"><![CDATA[<p>Мой пример чисто в переменных.</p>]]></content>
			<author>
				<name><![CDATA[Vascom]]></name>
				<uri>https://linuxforum.ru/profile.php?id=5339</uri>
			</author>
			<updated>2014-06-17T06:32:45Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=413206#p413206</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Сортировать слова в строке]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=413205#p413205" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>/tmp/ cat test.txt                                           
qwer abc 3 wert zxy
/tmp/ sed &#039;s/\ /\n/g&#039; test.txt | sort | tr &#039;\n&#039; &#039; &#039; &gt; new_1.txt
/tmp/ cat new_1.txt
3 abc qwer wert zxy</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Lupo Alberto]]></name>
				<uri>https://linuxforum.ru/profile.php?id=9018</uri>
			</author>
			<updated>2014-06-17T06:32:18Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=413205#p413205</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Сортировать слова в строке]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=413204#p413204" />
			<content type="html"><![CDATA[<p><strong>Lupo Alberto</strong>, в том и дело, что хотелось бы обойтись без помощи промежуточных файлов, всё чисто в переменных.</p>]]></content>
			<author>
				<name><![CDATA[fragment]]></name>
				<uri>https://linuxforum.ru/profile.php?id=22441</uri>
			</author>
			<updated>2014-06-17T06:31:57Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=413204#p413204</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Сортировать слова в строке]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=413203#p413203" />
			<content type="html"><![CDATA[<p>Ну сделай из них снова строку, например<br /></p><div class="codebox"><pre><code>a=`echo &quot;qwer abc 3 wert zxy&quot; | sed &#039;s/\ /\n/g&#039; | sort`
for k in $a
do
    echo -n &quot;$k &quot;
done</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Vascom]]></name>
				<uri>https://linuxforum.ru/profile.php?id=5339</uri>
			</author>
			<updated>2014-06-17T06:22:08Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=413203#p413203</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Сортировать слова в строке]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=413202#p413202" />
			<content type="html"><![CDATA[<p>Вот, «накостылил»&nbsp; &nbsp;<img src="https://linuxforum.ru/img/smilies/al.gif" alt="al" /> <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">/tmp/ cat test.txt <br />qwer abc 3 wert zxy<br />/tmp/ sed &#039;s/\ /\n/g&#039; test.txt | sort | sed &#039;:a; /$/N; s/\n/\ /; ta&#039; &gt; new.txt<br />/tmp/ cat new.txt <br />3 abc qwer wert zxy</div></p>]]></content>
			<author>
				<name><![CDATA[Lupo Alberto]]></name>
				<uri>https://linuxforum.ru/profile.php?id=9018</uri>
			</author>
			<updated>2014-06-17T06:14:51Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=413202#p413202</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Сортировать слова в строке]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=413200#p413200" />
			<content type="html"><![CDATA[<p>Да, уже нашёл, но это не подходит. Надо всё же отсортировать слова в строке.</p>]]></content>
			<author>
				<name><![CDATA[fragment]]></name>
				<uri>https://linuxforum.ru/profile.php?id=22441</uri>
			</author>
			<updated>2014-06-17T06:04:05Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=413200#p413200</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Сортировать слова в строке]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=413199#p413199" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>fragment пишет:</cite><blockquote><p>Ну или подскажите, как превратить такую строку в столбец, не прибегая к echo в файл?</p></blockquote></div><p>Примерно так</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">~/ echo &quot;qwer abc 3 wert zxy&quot; | sed &#039;s/\ /\n/g&#039; | sort<br />3<br />abc<br />qwer<br />wert<br />zxy</div></p>]]></content>
			<author>
				<name><![CDATA[Lupo Alberto]]></name>
				<uri>https://linuxforum.ru/profile.php?id=9018</uri>
			</author>
			<updated>2014-06-17T06:01:34Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=413199#p413199</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Сортировать слова в строке]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=413194#p413194" />
			<content type="html"><![CDATA[<p>Команда sort почему-то работает только если слова находятся каждое в новой строке (т.е. в столбец), а как отсортировать слова, расположенные в одной строке через пробел?</p><p>Ну или подскажите, как превратить такую строку в столбец, не прибегая к echo в файл?</p>]]></content>
			<author>
				<name><![CDATA[fragment]]></name>
				<uri>https://linuxforum.ru/profile.php?id=22441</uri>
			</author>
			<updated>2014-06-17T05:52:32Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=413194#p413194</id>
		</entry>
</feed>
