bash - getting a part of the output from a sed command -
i have command :
cat -n file.log | grep "start new test" | tail -1 | cut -f 1 | xargs -i % sed -n %',$s/is not alive/&/p' file.log
that gives output of whole line :
jan 19 23:20:33 s_localhost@file platmgt.xbin[3260]: blade 10 not alive jan 19 23:20:33 s_localhost@file platmgt.xbin[3260]: blade 11 not alive
how can modify last part : blade 11 not alive
can modify in way display :
error:blade 11 not alive ?
thank response
you can use cut delimit on colons , add error message:
cat -n file.log | grep "start new test" | tail -1 | cut -f 1 | xargs -i % sed -n %',$s/is not alive/&/p' file.log | cut -d: -f 4 | xargs -i % echo error: %
Comments
Post a Comment