We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 2ed807a + 1123dd2 commit 127b399Copy full SHA for 127b399
1 file changed
recipes/Bash/576876_awk_sample/recipe-576876.sh
@@ -1,6 +1,6 @@
1
-#!/bin/bash
+#!/usr/bin/env bash
2
3
-file=${1:?"file?"}
+FILE=${1:?"FILE?"}
4
5
echo $*
6
#get the fields
@@ -9,10 +9,10 @@ echo $*
9
#print the fields
10
11
#awk 'BEGIN { FS = "\n"; RS = "" }\
12
-#{print $2}' $file \
13
-sed -n '/.*user.*system.*/p' $file \
14
-|sed -e 's/user//' -e 's/system//' -e 's/elapsed//' |\
15
-awk 'BEGIN { FS = " "; RS = "\n" }\
+#{print $2}' $FILE \
+$(which sed) -n '/.*user.*system.*/p' ${FILE} \
+|$(which sed) -e 's/user//' -e 's/system//' -e 's/elapsed//' |\
+$(which awk) 'BEGIN { FS = " "; RS = "\n" }\
16
{split($3, real, ":"); $3=real[1]*60 + real[2]} \
17
#{printf $1 "\t"$2 "\t" $3"\n"} \
18
{ user_sum += $1; sys_sum += $2; real_sum += $3; count++} \
0 commit comments