<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
					xmlns:content="http://purl.org/rss/1.0/modules/content/"
					xmlns:wfw="http://wellformedweb.org/CommentAPI/"
					xmlns:atom="http://www.w3.org/2005/Atom"
				  >
<channel>
<atom:link rel="self"  type="application/rss+xml"  href="http://rulinux.net/rss_from_sect_4_subsect_6_thread_39066"  />
<title>rulinux.net - Форум - Development - bash построчное чтение файла</title>
<link>http://rulinux.net/</link>
<description><![CDATA[Портал о GNU/Linux и не только]]></description>
<image><title>rulinux.net - Форум - Development - bash построчное чтение файла</title>
<link>http://rulinux.net/</link>
<url>http://rulinux.net/rss_icon.png</url>
</image>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167723</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167723</guid>
<pubDate>Mon, 18 Mar 2013 14:23:42 +0400</pubDate>
<description><![CDATA[<p><i>>Да, но и на читаемый)))</i><br> Ну читаемость - штука субъективная:)</p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167719</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167719</guid>
<pubDate>Mon, 18 Mar 2013 13:59:04 +0400</pubDate>
<description><![CDATA[<p><i>> Здесь проходит конкурс на самый короткий питон-скрипт?</i><br> Да, но и на читаемый)))</p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167718</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167718</guid>
<pubDate>Mon, 18 Mar 2013 13:44:44 +0400</pubDate>
<description><![CDATA[<p>Добрый день. Здесь проходит конкурс на самый короткий питон-скрипт?<br><br><fieldset><legend>python</legend><code><br />
<span style="color: #808080; font-style: italic;">#!/usr/bin/python</span><br />
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>, <span style="color: #dc143c;">sys</span>, <span style="color: #dc143c;">subprocess</span> <span style="color: #ff7700;font-weight:bold;">as</span> sp<br />
<span style="color: #ff7700;font-weight:bold;">with</span> <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>, <span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">as</span> f: <span style="color: #008000;">list</span><span style="color: black;">&#40;</span><span style="color: #008000;">map</span><span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">lambda</span> m: sp.<span style="color: black;">call</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'wget'</span>, m<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span>, <span style="color: #483d8b;">'-O'</span>, <span style="color: #483d8b;">'{}.{}.{}'</span>.<span style="color: black;">format</span><span style="color: black;">&#40;</span>m<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>, m<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>, m<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span>-1<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>, <span style="color: #dc143c;">re</span>.<span style="color: black;">findall</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'#EXTINF:([0-9]+),([^<span style="color: #000099; font-weight: bold;">n</span>]+)[<span style="color: #000099; font-weight: bold;">n</span> ]+(http:[^<span style="color: #000099; font-weight: bold;">n</span>]+)'</span>, f.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp;</code></fieldset> </p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167716</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167716</guid>
<pubDate>Mon, 18 Mar 2013 13:05:20 +0400</pubDate>
<description><![CDATA[<p>&gt; Ох бле какой досадный баг, нет все таки не шесть а восемь)))
<br><br>
Я вижу семь %)</p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167714</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167714</guid>
<pubDate>Mon, 18 Mar 2013 12:54:45 +0400</pubDate>
<description><![CDATA[<p><i>> Посчитал строчки - получилось больше чем 9-10.</i><br><br><br>Просто я повёлся на предложный Сисмемом разбор строки и сортировку по каталогам по имени исполнителя и названию. И тоже сделал это. А так бы было всего восемь)))<br><br><fieldset><legend>python</legend><code><br />
<span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span><br />
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>, <span style="color: #dc143c;">sys</span><br />
<span style="color: #ff7700;font-weight:bold;">with</span> <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">args</span><span style="color: black;">&#91;</span>1<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">as</span> m3u:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> line <span style="color: #ff7700;font-weight:bold;">in</span> m3u <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #483d8b;">'#EXTINF'</span> <span style="color: #ff7700;font-weight:bold;">in</span> line<span style="color: black;">&#93;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dest = <span style="color: black;">&#91;</span>line.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'n'</span>,<span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span>line.<span style="color: black;">index</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">','</span><span style="color: black;">&#41;</span>+1:<span style="color: black;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #dc143c;">os</span>.<span style="color: black;">system</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'wget -O &quot;{0}.mp3&quot; {1}'</span>.<span style="color: black;">format</span><span style="color: black;">&#40;</span>dest, m3u.<span style="color: black;">next</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp;</code></fieldset></p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167707</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167707</guid>
<pubDate>Mon, 18 Mar 2013 11:37:30 +0400</pubDate>
<description><![CDATA[<p>Посчитал строчки - получилось больше чем 9-10. Но вообще хотя бы читабельно выглядит.</p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167699</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167699</guid>
<pubDate>Mon, 18 Mar 2013 07:20:26 +0400</pubDate>
<description><![CDATA[<p><i>>&gt; А лучше на питоне замутить строчек 9-10 от силы будет. </i><br><i>> Неспортивно!</i><br>А выносить мозги анончикам спортивно?)))<br><br><fieldset><legend>python</legend><code><br />
<span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span><br />
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span><br />
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span><br />
<span style="color: #ff7700;font-weight:bold;">import</span> argparse<br />
<br />
<span style="color: #dc143c;">parser</span> = argparse.<span style="color: black;">ArgumentParser</span><span style="color: black;">&#40;</span>description=<span style="color: #483d8b;">'M3U loader.'</span><span style="color: black;">&#41;</span><br />
<span style="color: #dc143c;">parser</span>.<span style="color: black;">add_argument</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'file'</span>, <span style="color: #008000;">help</span>=<span style="color: #483d8b;">'m3u file list'</span><span style="color: black;">&#41;</span><br />
<span style="color: #dc143c;">parser</span>.<span style="color: black;">add_argument</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'--path'</span>, <span style="color: #008000;">help</span>=<span style="color: #483d8b;">'download directory path'</span>, default=<span style="color: #483d8b;">'.'</span><span style="color: black;">&#41;</span><br />
args = <span style="color: #dc143c;">parser</span>.<span style="color: black;">parse_args</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
<span style="color: #ff7700;font-weight:bold;">with</span> <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>args.<span style="color: #008000;">file</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">as</span> m3u:<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> line <span style="color: #ff7700;font-weight:bold;">in</span> m3u:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #483d8b;">'#EXTINF'</span> <span style="color: #ff7700;font-weight:bold;">in</span> line:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">try</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; artist, song = line.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">n</span>'</span>,<span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span>line.<span style="color: black;">index</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">','</span><span style="color: black;">&#41;</span>+<span style="color: #ff4500;">1</span>:<span style="color: black;">&#93;</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">' - '</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; path = args.<span style="color: black;">path</span> + <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">sep</span> + artist<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">exists</span><span style="color: black;">&#40;</span>path<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #dc143c;">os</span>.<span style="color: black;">mkdir</span><span style="color: black;">&#40;</span>path<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #dc143c;">os</span>.<span style="color: black;">system</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'wget -O &quot;{0}{1}{2}.mp3&quot; {3}'</span>.<span style="color: black;">format</span><span style="color: black;">&#40;</span>path, <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">sep</span>, song, m3u.<span style="color: black;">next</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">except</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Wrong file format.'</span><span style="color: #66cc66;">;</span> <span style="color: #ff7700;font-weight:bold;">break</span><br />
&nbsp;</code></fieldset></p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167679</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167679</guid>
<pubDate>Sun, 17 Mar 2013 22:28:37 +0400</pubDate>
<description><![CDATA[<p><i>>Чем выбран сей язык ? Качаешь скилы для емакс лиспа ?</i><br> Я, в своё время, сдуру частично прочитал SICP, и, видимо, заразился. Теперь тянет к этой скобочной функциональщине.<br><br>ЛNСП. (СОЙДУТ (ВСЕХ ПРОЧNТАВШNХ) (С УМА)) </p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167678</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167678</guid>
<pubDate>Sun, 17 Mar 2013 22:25:57 +0400</pubDate>
<description><![CDATA[<p>o_0<br><br>Чем выбран сей язык ?    Качаешь скилы для емакс лиспа ?</p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167676</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167676</guid>
<pubDate>Sun, 17 Mar 2013 22:21:33 +0400</pubDate>
<description><![CDATA[<p><i>>Охбле... Ты наверное ещё сутра начал ЭТО писать %)</i><br> На самом деле я просто уже писал что-то похожее для youtube-dl и списка файлов, как раз на guile. Хотелось на эту штуку посмотреть. Поэтому тут всё вышло довольно быстро и легко. </p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167674</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167674</guid>
<pubDate>Sun, 17 Mar 2013 22:17:37 +0400</pubDate>
<description><![CDATA[<p>Охбле... Ты наверное ещё сутра начал ЭТО писать %)</p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167670</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167670</guid>
<pubDate>Sun, 17 Mar 2013 22:03:27 +0400</pubDate>
<description><![CDATA[<p><i>>А лучше на питоне замутить строчек 9-10 от силы будет.</i><br> Неспортивно!<br><br><fieldset><legend></legend><code><br />
<span style="color: #339933;">#!/usr/bin/guile <br />
-e main -s</span><br />
<span style="color: #339933;">!</span><span style="color: #339933;">#</span><br />
<span style="color: #009900;">&#40;</span>use<span style="color: #339933;">-</span>modules <span style="color: #009900;">&#40;</span>ice<span style="color: #339933;">-</span>9 getopt<span style="color: #339933;">-</span><span style="color: #993333;">long</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#40;</span>ice<span style="color: #339933;">-</span><span style="color: #0000dd;">9</span> rw<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#40;</span>ice<span style="color: #339933;">-</span><span style="color: #0000dd;">9</span> regex<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#40;</span>ice<span style="color: #339933;">-</span><span style="color: #0000dd;">9</span> popen<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#40;</span>ice<span style="color: #339933;">-</span><span style="color: #0000dd;">9</span> format<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
<br />
<br />
<span style="color: #009900;">&#40;</span>define file<span style="color: #339933;">-</span>regexp <span style="color: #009900;">&#40;</span>make<span style="color: #339933;">-</span>regexp <span style="color: #ff0000;">&quot;#EXTINF:([0-9]+),([^<span style="color: #000099; font-weight: bold;">n</span>]+)[<span style="color: #000099; font-weight: bold;">n</span> ]+(http:[^<span style="color: #000099; font-weight: bold;">n</span>]+)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
<br />
<br />
<span style="color: #009900;">&#40;</span>define <span style="color: #009900;">&#40;</span>file<span style="color: #339933;">-</span>contents file<span style="color: #009900;">&#41;</span><br />
&nbsp; <span style="color: #009900;">&#40;</span>call<span style="color: #339933;">-</span>with<span style="color: #339933;">-</span>input<span style="color: #339933;">-</span>file file<br />
&nbsp; &nbsp; <span style="color: #009900;">&#40;</span>lambda <span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#40;</span>let<span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>size <span style="color: #009900;">&#40;</span>stat<span style="color: #339933;">:</span>size <span style="color: #009900;">&#40;</span>stat p<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#40;</span>buf <span style="color: #009900;">&#40;</span>make<span style="color: #339933;">-</span><span style="color: #993333;">string</span> size<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#40;</span>read<span style="color: #339933;">-</span><span style="color: #993333;">string</span><span style="color: #339933;">!/</span>partial buf p<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; buf<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
<br />
<br />
<span style="color: #009900;">&#40;</span>define <span style="color: #009900;">&#40;</span>get<span style="color: #339933;">-</span>files file path debug<span style="color: #009900;">&#41;</span><br />
&nbsp; <span style="color: #009900;">&#40;</span>define <span style="color: #009900;">&#40;</span>download match count<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#40;</span>let<span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>num <span style="color: #009900;">&#40;</span>string<span style="color: #339933;">-</span>trim<span style="color: #339933;">-</span>both <span style="color: #009900;">&#40;</span>match<span style="color: #339933;">:</span>substring match <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#40;</span>fname <span style="color: #009900;">&#40;</span>string<span style="color: #339933;">-</span>trim<span style="color: #339933;">-</span>both <span style="color: #009900;">&#40;</span>match<span style="color: #339933;">:</span>substring match <span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#40;</span>url <span style="color: #009900;">&#40;</span>string<span style="color: #339933;">-</span>trim<span style="color: #339933;">-</span>both <span style="color: #009900;">&#40;</span>match<span style="color: #339933;">:</span>substring match <span style="color: #0000dd;">3</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#40;</span>ext <span style="color: #009900;">&#40;</span>car <span style="color: #009900;">&#40;</span>reverse <span style="color: #009900;">&#40;</span>string<span style="color: #339933;">-</span>split url <span style="color: #339933;">#.))))</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#40;</span>esc <span style="color: #009900;">&#40;</span>regexp<span style="color: #339933;">-</span>substitute<span style="color: #339933;">/</span>global <span style="color: #339933;">#f &quot;&quot;&quot; fname 'pre &quot;\&quot;&quot; 'post))</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#40;</span>fpath <span style="color: #009900;">&#40;</span>format <span style="color: #339933;">#f &quot;&quot;~a~a.~a.~a&quot;&quot; path num esc ext))</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#40;</span>cmd <span style="color: #009900;">&#40;</span>format <span style="color: #339933;">#f &quot;wget &quot;~a&quot; -O ~a || rm -f ~a&quot; url fpath fpath)))</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#40;</span><span style="color: #b1b100;">if</span> debug<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#40;</span>format <span style="color: #339933;">#t &quot;~a~%&quot; cmd)</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#40;</span>system cmd<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #339933;">+</span> count<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; <span style="color: #009900;">&#40;</span>format <span style="color: #339933;">#t</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">&quot;Downloaded ~a files~%&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#40;</span>fold<span style="color: #339933;">-</span>matches file<span style="color: #339933;">-</span>regexp <span style="color: #009900;">&#40;</span>file<span style="color: #339933;">-</span>contents file<span style="color: #009900;">&#41;</span> <span style="color: #0000dd;">0</span> download<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
<br />
<br />
<span style="color: #009900;">&#40;</span>define <span style="color: #009900;">&#40;</span>main args<span style="color: #009900;">&#41;</span><br />
&nbsp; <span style="color: #009900;">&#40;</span>let<span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>option<span style="color: #339933;">-</span>spec <span style="color: #ff0000;">'((debug (single-char #d) (value #f))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (file (single-char #<span style="color: #000099; font-weight: bold;">f</span>) (value #t))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (path (single-char #p) (value #t))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (help (single-char #h) (value #f))))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(options (getopt-long args option-spec))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(show-help (option-ref options '</span>help <span style="color: #339933;">#f))</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#40;</span>file <span style="color: #009900;">&#40;</span>option<span style="color: #339933;">-</span>ref options <span style="color: #ff0000;">'file #f))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(debug (option-ref options '</span>debug <span style="color: #339933;">#f))</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#40;</span>path <span style="color: #009900;">&#40;</span>option<span style="color: #339933;">-</span>ref options <span style="color: #ff0000;">'path &quot;&quot;)))<br />
&nbsp; &nbsp; (if (or show-help (not file))<br />
&nbsp; &nbsp; &nbsp; &nbsp; (format #t &quot;<span style="color: #000099; font-weight: bold;"><br />
</span>Usage: [options]<br />
<span style="color: #000099; font-weight: bold;">t</span>-p|--path<span style="color: #000099; font-weight: bold;">t</span>Download directory (default: <span style="color: #000099; font-weight: bold;">&quot;</span><span style="color: #000099; font-weight: bold;">&quot;</span>)<br />
<span style="color: #000099; font-weight: bold;">t</span>-d|--debug<span style="color: #000099; font-weight: bold;">t</span>Debug<br />
<span style="color: #000099; font-weight: bold;">t</span>-h|--help<span style="color: #000099; font-weight: bold;">t</span><br />
<span style="color: #000099; font-weight: bold;">t</span>-f|--file<span style="color: #000099; font-weight: bold;">t</span>Data file~%&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; (get-files file path debug))))<br />
</span></code></fieldset><br><br>UPD: и правда, жрёт слеши, ненасытный! <a href="https://gist.github.com/anonymous/5183846">Вот</a>, если вдруг надо.</p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167616</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167616</guid>
<pubDate>Sat, 16 Mar 2013 12:01:15 +0400</pubDate>
<description><![CDATA[<p>Добавил экранирование двойных кавычек на случай если встретятся в названии песни: <a href="http://pastebin.com/PaTuTkhz">http://pastebin.com/PaTuTkhz</a></p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167614</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167614</guid>
<pubDate>Sat, 16 Mar 2013 11:45:03 +0400</pubDate>
<description><![CDATA[<p>Я про теги ничего не знаю</p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167613</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167613</guid>
<pubDate>Sat, 16 Mar 2013 11:41:35 +0400</pubDate>
<description><![CDATA[<p>дописал бы еще чтоб теги заполнял.</p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167611</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167611</guid>
<pubDate>Sat, 16 Mar 2013 11:22:35 +0400</pubDate>
<description><![CDATA[<p><fieldset><legend>text</legend><code><br />
#! /bin/awk -f <br />
<br />
# &nbsp;Running examples (simple.awk is name of this script):<br />
#<br />
# &nbsp;./simple.awk sample.txt<br />
# &nbsp;./simple.awk -v debug=1 sample.txt<br />
# &nbsp;./simple.awk -v path='~/Media/' sample.txt<br />
# &nbsp;./simple.awk -v debug=1 -v path='~/Media/' sample.txt<br />
<br />
BEGIN { <br />
&nbsp; &nbsp; &nbsp; &nbsp; LDEBUG=&quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; LPATH=&quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(length(path)&gt;0){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LPATH=path;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(length(debug)&gt;0){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LDEBUG=debug;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; extinf=&quot;&quot;;<br />
}<br />
<br />
/^#EXTINF:[0-9]+,.+$/{<br />
&nbsp; gsub(/[ tnr]+$/,&quot;&quot;); # remove trailing non-printable chars from $0<br />
&nbsp; match($0,/^#EXTINF:([0-9]+),(.+)[[:space:]]*$/,ar);<br />
&nbsp; extinf = &quot;&quot;&quot; ar[1] &quot;.&quot; ar[2] &quot;.mp3&quot;&quot;;<br />
&nbsp; if(LPATH) &nbsp;extinf = LPATH extinf;<br />
&nbsp; if(LDEBUG) print extinf;<br />
}<br />
<br />
/^http://.+.mp3[ nrt]*$/{<br />
&nbsp; if(extinf){<br />
&nbsp; &nbsp; gsub(/[ tnr]+$/,&quot;&quot;); # remove trailing non-printable chars from $0<br />
&nbsp; &nbsp; cmd=&quot;wget -O &quot;extinf&quot; '&quot;$0&quot;'&quot;;<br />
&nbsp; &nbsp; if(LDEBUG) print cmd;<br />
&nbsp; &nbsp; else system(cmd);<br />
&nbsp; &nbsp; extinf=&quot;&quot;;<br />
&nbsp; }<br />
}<br />
&nbsp;</code></fieldset>


<br><br>
P.S.<br>
Нет! Не пользуйся тем что выше - движок сожрал обратные слеши! Вот выложил на <a href="http://pastebin.com/M5HZQU6q">pastebin.com</a> - там вроде нормально отображается.
<br><br>
P.P.S.<br>
По дефолту, без &quot;-v debug=1&quot;, оно будет пытаться качать. С &quot;-v debug=1&quot; просто отпечатает имена файлов и что будет запущено.</p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167610</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167610</guid>
<pubDate>Sat, 16 Mar 2013 11:14:31 +0400</pubDate>
<description><![CDATA[<p><div class="quote"><pre>sed -n '/http/p' 1.txt &gt; 2.txt</pre></div> , где 1.txt - исходный материал, 2.txt - место сохранения ссылок. <br /> Осталось только скачать используя ссылки из 2.txt <div class="quote"><pre>wget -i /путь/2.txt</pre></div> <br /> Кстати, у меня выдает 404, при попытке скачать файлы. Видать сесия по ip или окончилось время. Чтобы еще автоматом заполнить теги, уже придется повозится.  </p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167608</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167608</guid>
<pubDate>Sat, 16 Mar 2013 08:41:17 +0400</pubDate>
<description><![CDATA[<p>не выебывайся слушай музычку вкоташле как все - онлайн.<br><br> &#92; ув. тов. м-р</p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167606</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167606</guid>
<pubDate>Sat, 16 Mar 2013 08:03:18 +0400</pubDate>
<description><![CDATA[<p>А лучше на питоне замутить строчек 9-10 от силы будет.</p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167605</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167605</guid>
<pubDate>Sat, 16 Mar 2013 07:49:05 +0400</pubDate>
<description><![CDATA[<p><div class="quote"><pre># печать строк совпадающих с регулярным выражением (эмуляция grep)  sed -n '/regexp/p'           # вариант 1  sed '/regexp/!d'             # вариант 2</pre></div> Вот к примеру. Написать весь костыль нету времени.</p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167604</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167604</guid>
<pubDate>Sat, 16 Mar 2013 07:42:09 +0400</pubDate>
<description><![CDATA[<p>Копируешь текст в файл, ищещь в инете инфу о редакторе sed. Делаешь вывод в stdout только строк с &quot;http&quot; потом wget или lftp.</p>]]></description>
</item>
<item>
<title>Re:bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167603</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167603</guid>
<pubDate>Sat, 16 Mar 2013 07:36:07 +0400</pubDate>
<description><![CDATA[<p>Читаешь строку, начинающийся с #EXTINF, берёшь из неё что нужно для названия. Затем wget ссылка -O &quot;название&quot;.</p>]]></description>
</item>
<item>
<title>bash построчное чтение файла</title>
<link>https://rulinux.net/message.php?newsid=39066&amp;page=1#167602</link>
<guid>https://rulinux.net/message.php?newsid=39066&amp;page=1#167602</guid>
<pubDate>Sat, 16 Mar 2013 07:21:50 +0400</pubDate>
<description><![CDATA[<p>После потери музыкальной коллекции, пришлось обходиться мини-коллекции в vk.com <br /> Но захотелось скачать. <br /> С помощью MusicSig я получил список музыки в таком виде:<br><br><br /> #EXTM3U <br /> #EXTINF:179,Ashes Remain - Change My Life <br /> http://cs5042.vk.me/u679124/audios/f2c127f5d886.mp3 <br /> #EXTINF:171,Ashes Remain - Right Here <br /> http://cs4691.vk.me/u16643/audios/ff86abc22d6d.mp3 <br /> #EXTINF:170,Ashes Remain - End of Me <br /> http://cs4874.vk.me/u7197060/audios/d012470224f2.mp3<br><br>wget может скачать это, но с назвать типа f2c127f5d886.mp3<br><br>Вопрос: как правильно написать этот скрипт на Bash? <br /> (Готовий скрипт с комментариями приветствуется)</p>]]></description>
</item>
</channel>
</rss>