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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -