is there any line before aaa and after eee in the file ?
if there is not than the code is;
let "currentline=`grep -n string inputfile|awk -F ':' {print $1} '`-1"
sed -n "${currentline}s/.*/&/p" inputfile>outfile
if there is. it is a bit harder .The code is ;
let "currentline=`grep -n string inputfile|awk -F ':' ' {print $1} '`-1"
let "fisrtpart=$currentline-5"
let "secondpart=$currentline+4"
sed -n "1,${firstpart}s/.*/&/p" inputfile>outfile
sed -n "${currentline}s/.*/&/p" inputfile>>outfile
sed -n "$secondpart,\$s/.*/&/p" inputfile>>outfile