Message ID | 20220620192934.21694-3-ddiss@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | check: minor cleanups and xunit report fix | expand |
On Mon, Jun 20, 2022 at 09:29:30PM +0200, David Disseldorp wrote: > There's no need to use grep and awk when the latter can do all that's > needed, including the pretty printing. > > Signed-off-by: David Disseldorp <ddiss@suse.de> > --- > check | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/check b/check > index 42925e09..43c072d2 100755 > --- a/check > +++ b/check > @@ -819,13 +819,9 @@ function run_section() > try="$try $seqnum" > n_try=`expr $n_try + 1` > > - # slashes now in names, sed barfs on them so use grep > - lasttime=`grep -w ^$seqnum $check.time | awk '// {print $2}'` > - if [ "X$lasttime" != X ]; then > - echo -n " ${lasttime}s ... " > - else > - echo -n " " # prettier output with timestamps. > - fi > + awk 'BEGIN {lasttime=" "} \ > + $1 == "'$seqnum'" {lasttime=" " $2 "s ... "; exit} \ > + END {printf "%s", lasttime}' "$check.time" I'm not good at 'awk' so much, but this change looks not break old format. Reviewed-by: Zorro Lang <zlang@redhat.com> > rm -f core $seqres.notrun > > start=`_wallclock` > -- > 2.35.3 >
diff --git a/check b/check index 42925e09..43c072d2 100755 --- a/check +++ b/check @@ -819,13 +819,9 @@ function run_section() try="$try $seqnum" n_try=`expr $n_try + 1` - # slashes now in names, sed barfs on them so use grep - lasttime=`grep -w ^$seqnum $check.time | awk '// {print $2}'` - if [ "X$lasttime" != X ]; then - echo -n " ${lasttime}s ... " - else - echo -n " " # prettier output with timestamps. - fi + awk 'BEGIN {lasttime=" "} \ + $1 == "'$seqnum'" {lasttime=" " $2 "s ... "; exit} \ + END {printf "%s", lasttime}' "$check.time" rm -f core $seqres.notrun start=`_wallclock`
There's no need to use grep and awk when the latter can do all that's needed, including the pretty printing. Signed-off-by: David Disseldorp <ddiss@suse.de> --- check | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)