Pipe Data From Grep Into A File

I am somewhat of a novice at unix scripting and I need a little help. Here is what im trying to do:

I am trying to figure out how to pipe the following grep results into a file.

/source/programs: grep "WSBL020" W*
WBMB991.cbl: COPY WSBL020.
WDCB003.cbl: COPY WSBL020.
WDCB004.cbl: COPY WSBL020.
WOVB020.cbl:000926 COPY WSBL020

I only want the first 7 characters of each line of results preceeded by "compile". What I want is a file that looks like the following:

compile WBMB991
compile WDCB003
compile WDCB004
compile WOVB020

I have a copybook that has changed and I need to recompile about 200 programs and I was trying to figure out an easy way to do it.....please help!

Not tested --

grep "WSBL020" W* | awk '{ print "compile " substr($0,1,7) }' > myfile

try this

grep "WSBL020" W* | awk '{ print "compile",substr($0, 1, 7) }'

if want to put in a file

grep "WSBL020" W* | awk '{ print "compile",substr($0, 1, 7) }' >filename

grep "WSBL020" W* | sed "s/\(.\{7\}\).*/compile \1/" > file

Thanks!!! Worked perfectly