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

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -