[shr-u] update shr quite safely

Rui Miguel Silva Seabra rms at 1407.org
Mon Jul 27 11:04:40 CEST 2009


Most of my knowledge of cat comes from:

 a) man page
 b) a class where one of the subjects was programming in awk (and other tools)
 c) web search for particular cases, problems, or examples :)

Perhaps googling for "awk howto" or "awk programming" etc...

However, it's probably not worth investing a lot of time in awk unless
you really have to (grades, salary, etc...)

Rui

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

> _______________________________________________
> Openmoko community mailing list
> community at lists.openmoko.org
> http://lists.openmoko.org/mailman/listinfo/community


-- 



More information about the community mailing list