man page of awk is humongous!<br>"...it's probably not worth investing a lot of time in awk unless you really have to (grades, salary, etc...)"<br>he he ok, i'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"><<a href="mailto:rms@1407.org">rms@1407.org</a>></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 "awk howto" or "awk programming" etc...<br>
<br>
However, it'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>
> ok, thanks! (i'll try to reduce my useless cats)<br>
> but awk syntax is really "awkward" ;-) do you know a bright guide for awk?<br>
> (please not man awk...)<br>
> d<br>
><br>
> On Sun, Jul 26, 2009 at 10:12 PM, Rui Miguel Silva Seabra <<a href="mailto:rms@1407.org">rms@1407.org</a>>wrote:<br>
><br>
> > Because you launched 1 program then 4 programs in background, which<br>
> > are fed to a while loop => much memory + cpu usage.<br>
> ><br>
> > With... opkg list_upgradable | awk '!/(kernel|Multiple)/ {print $1}'<br>
> ><br>
> > ... you now launch less 3 programs than before (two greps and one cat),<br>
> > while feeding exactly the same output to the while loop. :)<br>
> ><br>
> > If you grep then awk or awk then grep, then 99% of the time you're<br>
> > uselessly greping. Awk greps better than grep, specially when you<br>
> > want to transform the output :)<br>
> ><br>
> > Also a nice read: Useless use of cat<br>
> > <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>
> ><br>
> > Rui<br>
> ><br>
> > On Sun, Jul 26, 2009 at 09:40:26PM +0200, Davide Scaini wrote:<br>
> > > he he this is the power of opensource...<br>
> > > why you said that is heavy? (i just want to learn, i'm quite newbie in<br>
> > > scripting and expecially using awk...)<br>
> > > d<br>
> > ><br>
> > > On Sun, Jul 26, 2009 at 8:29 PM, Rui Miguel Silva Seabra <<a href="mailto:rms@1407.org">rms@1407.org</a><br>
> > >wrote:<br>
> > ><br>
> > > > On Sun, Jul 26, 2009 at 07:18:07PM +0100, Rui Miguel Silva Seabra<br>
> > wrote:<br>
> > > > > On Sun, Jul 26, 2009 at 07:49:19PM +0200, Davide Scaini wrote:<br>
> > > > > > I want to share my little bash script to update shr without<br>
> > distroying<br>
> > > > my<br>
> > > > > > existing kernel (a true 2.6.28).<br>
> > > > > > It's really stupid, but maybe someone could find it interesting.<br>
> > > > > ><br>
> > > > > > opkg list_upgradable > upgradable<br>
> > > > > ><br>
> > > > > > cat upgradable | awk '{print $1}' | grep -v kernel | grep -v<br>
> > Multiple |<br>
> > > > > > while read line<br>
> > > > > ><br>
> > > > > > do echo "installing pack $line"<br>
> > > > > > opkg install $line<br>
> > > > > > done<br>
> > > > > ><br>
> > > > > > I have a script called upgrade.sh and I run that one. If you don't<br>
> > want<br>
> > > > to<br>
> > > > > > update for example tangogps (or wathever) just add<br>
> > > > > > grep -v tangogps |<br>
> > > > > > just before "while read line"...<br>
> > > > ><br>
> > > > > Nice. But a little heavy on the little Neos :) May I suggest a<br>
> > possible<br>
> > > > > alternative?<br>
> > > ><br>
> > > > oops a mistake, this one is corrected, though:<br>
> > > ><br>
> > > > opkg list_upgradable | awk '!/(kernel|Multiple)/ {print $1}' | \<br>
> > > > while read line; do<br>
> > > > echo "installing pack $line"<br>
> > > > opkg install $line<br>
> > > > done<br>
> > > ><br>
> > > > Rui<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>
> > > ><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>
> ><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>
> ><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>
<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>