linux - How can I extract 2 pieces of information output from command though pipes in a bash script? -
i have command produces next output:
{i} count {0} 167 real 0m1.370s user 0m0.008s sys 0m0.000s
i pipe output extract items on line 2 , line 4, , output them in single line follows:
167 0m1.370s
i have used sed , awk single value, can gerrymander these stream tools process multiline output?
you can utilize pipe output awk:
awk '/\{0\}/{p=$2} /real/{print p, $2; exit}'
linux bash awk sed
No comments:
Post a Comment