awk '/pattern/{getline;print;getline;getline;print}' file
sed -n '/pattern/{n;p;n;p;}' file
sed -n '/pattern/,+2p' file
Get between two pattern
awk '/pattern1/,/pattern2/' file
sed -n '/pattern1/,/pattern2/p' file
This is small script do same another way.
pattern=yourpattern
bgn=$(grep -n $pattern scsconfig.log awk -F: {'print $1'})
ed=`expr $bgn + 3`
cat scsconfig.log sed -n ''$bgn','$ed'p'
No comments:
Post a Comment