(echo "abc";echo "def")|awk '/abc/{match($0,"b");print RSTART,RLENGTH;substr();} !/abc/{print}'