man page of awk is humongous!<br>&quot;...it&#39;s probably not worth investing a lot of time in awk unless you really have to (grades, salary, etc...)&quot;<br>he he ok, i&#39;ll wait. Thanks for your tips, at least i learnt some things ;-)<br>

d<br><br><br><div class="gmail_quote">On Mon, Jul 27, 2009 at 11:04 AM, Rui Miguel Silva Seabra <span dir="ltr">&lt;<a href="mailto:rms@1407.org">rms@1407.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Most of my knowledge of cat comes from:<br>
<br>
 a) man page<br>
 b) a class where one of the subjects was programming in awk (and other tools)<br>
 c) web search for particular cases, problems, or examples :)<br>
<br>
Perhaps googling for &quot;awk howto&quot; or &quot;awk programming&quot; etc...<br>
<br>
However, it&#39;s probably not worth investing a lot of time in awk unless<br>
you really have to (grades, salary, etc...)<br>
<font color="#888888"><br>
Rui<br>
</font><div><div></div><div class="h5"><br>
On Mon, Jul 27, 2009 at 10:57:42AM +0200, Davide Scaini wrote:<br>
&gt; ok, thanks! (i&#39;ll try to reduce my useless cats)<br>
&gt; but awk syntax is really &quot;awkward&quot; ;-) do you know a bright guide for awk?<br>
&gt; (please not man awk...)<br>
&gt; d<br>
&gt;<br>
&gt; On Sun, Jul 26, 2009 at 10:12 PM, Rui Miguel Silva Seabra &lt;<a href="mailto:rms@1407.org">rms@1407.org</a>&gt;wrote:<br>
&gt;<br>
&gt; &gt; Because you launched 1 program then 4 programs in background, which<br>
&gt; &gt; are fed to a while loop =&gt; much memory + cpu usage.<br>
&gt; &gt;<br>
&gt; &gt; With...  opkg list_upgradable | awk &#39;!/(kernel|Multiple)/ {print $1}&#39;<br>
&gt; &gt;<br>
&gt; &gt; ... you now launch less 3 programs than before (two greps and one cat),<br>
&gt; &gt; while feeding exactly the same output to the while loop. :)<br>
&gt; &gt;<br>
&gt; &gt; If you grep then awk or awk then grep, then 99% of the time you&#39;re<br>
&gt; &gt; uselessly greping. Awk greps better than grep, specially when you<br>
&gt; &gt; want to transform the output :)<br>
&gt; &gt;<br>
&gt; &gt; Also a nice read: Useless use of cat<br>
&gt; &gt;                  <a href="http://www.google.pt/search?q=useless+use+of+cat" target="_blank">http://www.google.pt/search?q=useless+use+of+cat</a><br>
&gt; &gt;<br>
&gt; &gt; Rui<br>
&gt; &gt;<br>
&gt; &gt; On Sun, Jul 26, 2009 at 09:40:26PM +0200, Davide Scaini wrote:<br>
&gt; &gt; &gt; he he this is the power of opensource...<br>
&gt; &gt; &gt; why you said that is heavy? (i just want to learn, i&#39;m quite newbie in<br>
&gt; &gt; &gt; scripting and expecially using awk...)<br>
&gt; &gt; &gt; d<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; On Sun, Jul 26, 2009 at 8:29 PM, Rui Miguel Silva Seabra &lt;<a href="mailto:rms@1407.org">rms@1407.org</a><br>
&gt; &gt; &gt;wrote:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; On Sun, Jul 26, 2009 at 07:18:07PM +0100, Rui Miguel Silva Seabra<br>
&gt; &gt; wrote:<br>
&gt; &gt; &gt; &gt; &gt; On Sun, Jul 26, 2009 at 07:49:19PM +0200, Davide Scaini wrote:<br>
&gt; &gt; &gt; &gt; &gt; &gt;  I want to share my little bash script to update shr without<br>
&gt; &gt; distroying<br>
&gt; &gt; &gt; &gt; my<br>
&gt; &gt; &gt; &gt; &gt; &gt; existing kernel (a true 2.6.28).<br>
&gt; &gt; &gt; &gt; &gt; &gt; It&#39;s really stupid, but maybe someone could find it interesting.<br>
&gt; &gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; &gt; opkg list_upgradable &gt; upgradable<br>
&gt; &gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; &gt; cat upgradable | awk &#39;{print $1}&#39; | grep -v kernel | grep -v<br>
&gt; &gt; Multiple |<br>
&gt; &gt; &gt; &gt; &gt; &gt; while read line<br>
&gt; &gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; &gt; do echo &quot;installing pack $line&quot;<br>
&gt; &gt; &gt; &gt; &gt; &gt; opkg install $line<br>
&gt; &gt; &gt; &gt; &gt; &gt; done<br>
&gt; &gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; &gt; I have a script called upgrade.sh and I run that one. If you don&#39;t<br>
&gt; &gt; want<br>
&gt; &gt; &gt; &gt; to<br>
&gt; &gt; &gt; &gt; &gt; &gt; update for example tangogps (or wathever) just add<br>
&gt; &gt; &gt; &gt; &gt; &gt; grep -v tangogps |<br>
&gt; &gt; &gt; &gt; &gt; &gt; just before &quot;while read line&quot;...<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; Nice. But a little heavy on the little Neos :) May I suggest a<br>
&gt; &gt; possible<br>
&gt; &gt; &gt; &gt; &gt; alternative?<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; oops a mistake, this one is corrected, though:<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; opkg list_upgradable | awk &#39;!/(kernel|Multiple)/ {print $1}&#39; | \<br>
&gt; &gt; &gt; &gt;         while read line; do<br>
&gt; &gt; &gt; &gt;                echo &quot;installing pack $line&quot;<br>
&gt; &gt; &gt; &gt;                opkg install $line<br>
&gt; &gt; &gt; &gt;        done<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Rui<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; _______________________________________________<br>
&gt; &gt; &gt; &gt; Openmoko community mailing list<br>
&gt; &gt; &gt; &gt; <a href="mailto:community@lists.openmoko.org">community@lists.openmoko.org</a><br>
&gt; &gt; &gt; &gt; <a href="http://lists.openmoko.org/mailman/listinfo/community" target="_blank">http://lists.openmoko.org/mailman/listinfo/community</a><br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; &gt; _______________________________________________<br>
&gt; &gt; &gt; Openmoko community mailing list<br>
&gt; &gt; &gt; <a href="mailto:community@lists.openmoko.org">community@lists.openmoko.org</a><br>
&gt; &gt; &gt; <a href="http://lists.openmoko.org/mailman/listinfo/community" target="_blank">http://lists.openmoko.org/mailman/listinfo/community</a><br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; --<br>
&gt; &gt;<br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; Openmoko community mailing list<br>
&gt; &gt; <a href="mailto:community@lists.openmoko.org">community@lists.openmoko.org</a><br>
&gt; &gt; <a href="http://lists.openmoko.org/mailman/listinfo/community" target="_blank">http://lists.openmoko.org/mailman/listinfo/community</a><br>
&gt; &gt;<br>
<br>
&gt; _______________________________________________<br>
&gt; Openmoko community mailing list<br>
&gt; <a href="mailto:community@lists.openmoko.org">community@lists.openmoko.org</a><br>
&gt; <a href="http://lists.openmoko.org/mailman/listinfo/community" target="_blank">http://lists.openmoko.org/mailman/listinfo/community</a><br>
<br>
<br>
--<br>
<br>
_______________________________________________<br>
Openmoko community mailing list<br>
<a href="mailto:community@lists.openmoko.org">community@lists.openmoko.org</a><br>
<a href="http://lists.openmoko.org/mailman/listinfo/community" target="_blank">http://lists.openmoko.org/mailman/listinfo/community</a><br>
</div></div></blockquote></div><br>