Grepping characters

Hi friends,
I want your help.
I have a flat file. I want a script to search following pattern in it and once it get that pattern it should grep next 7 characters from it and should keep it in output file output.TXT

Pattern is
RSTD3R0*******

In above example, characters in the place of * (7 characters after pattern RSTD3R0) should be grepped and sent to output.TXT file.

How it can be done?
Kindly help

Regards
Anushree

assuming there will always be more than 7 characters after the match string

awk '$0 ~ /RSTD3R0/{match($0,"RSTD3R0");print substr($0,RSTART+RLENGTH,7)}' file

cheers,
Devaraj Takhellambam

sed -n '/pattern/ {
s/^.*pattern\(.\{7\}\).*$/\1/
p
}' a.txt

Thank you guys... It worked fine.. extracted exactly what i wanted... Thank you very much

Anushree.a