lkml.org 
[lkml]   [2009]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/3]: Replace kernel/timeconst.pl with kernel/timeconst.sh
From
Date
On Sat, 03 Jan 2009 19:36:04 CST, Rob Landley said:
> On Saturday 03 January 2009 06:28:22 Ingo Oeser wrote:
> > > +for i in "MSEC 1000" "USEC 1000000"
> > > +do
> > > + NAME=$(echo $i | awk '{print $1}')
> >
> > cut -d' ' -f1 does the same
> >
> > > + PERIOD=$(echo $i | awk '{print $2}')
> >
> > cut -d' ' -f2 does the same

Close, but no cee-gar. cut does something counter-intuitive with multiple
blanks:

% echo 'a b' | awk '{print $2}'
b
% echo 'a b' | cut -d' ' -f2

% echo 'a b' | sed -r 's/[ ]+/ /g' | cut -d' ' -f2
b

Unfortunately, 'sed -r' isn't in the opengroup.org list of required options,
and sed 's/ / /g' doesn't DTRT for 3 or more blanks (as it won't recursively
apply the change to a *new* double blank formed by the previous change).

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2009-01-04 06:11    [W:0.131 / U:2.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site