extract text b/w two delimiters

I have an input file which looks like

"
@$SCRIPT/atp_asrmt_adj.sql
$SCRIPT/dba2000.scr -s / @$SCRIPT/cim1005w.pls
$SCRIPT/dba2000.scr -s / @$SCRIPT/cim1006w.pls
start $SCRIPT/cim1020d.sql;^M
spool $DATA/cim1021m.sql
@$DATA/cim1021m.sql
! rm $DATA/cim1021m.sql
spool $DATA/cim1021m.sql
@$DATA/cim1021m.sql
! rm $DATA/cim1021m.sql
start $SCRIPT/art_matrix_audit_purge.pls
start $SCRIPT/event_sku_price_log_purge.pls
start $SCRIPT/event_sku_price_audit_purge.pls
start $SCRIPT/event_sku_rscn_audit_purge.pls
@$SCRIPT/in_process_audit_purge.sql
$SCRIPT/dba2000.scr /NOLOG @$SCRIPT/mphdsum.pls
ERROR_SCRIPT "Error with deduct.pls"
$SCRIPT/dba2000.scr /NOLOG @$SCRIPT/pastdue.pls
ERROR_SCRIPT "Error with pastdue.pls"
$SCRIPT/dba2000.scr /NOLOG @$SCRIPT/ordpos1.pls
ERROR_SCRIPT "Error with ordpos1.pls"
$SCRIPT/dba2000.scr /NOLOG @$SCRIPT/ordpos2.pls
ERROR_SCRIPT "Error with ordpos2.pls"
ERROR_SCRIPT "Error Code:'$RCSUM!' in sum1so.sql"
ERROR_SCRIPT "Error Code:'$RCSUM2' in sum2so.sql"
ERROR_SCRIPT "Error Code:'$RCSUM3' in sum3so.sql"
"

My requirement is to extract all the text b/w :
1). "/" and ".sql"
2)."/" and ".pls"
3)." " and ".sql"
4)." " and ".pls"

It is really urgent, any suggestion would be highly appreciated.
Thanks
NB: there might be a number of "/" in a line

You will need to do something more than just copy/paste as I am not going to write everything by you (you should learn it and code it), but here it goes:

  1. You will fall into deep s**t whenever a filename contain special characters/new line.

  2. Code:
    while read -p line; do
    [[ -z "${line}" ]] && continue
    line="${line##/|\ }"
    line="${line%.pls}"
    [[ -n "${line}" ]] && print -- "${line}"
    done

EDIT: This is a korn shell's code to be clear.
I believe that you could do it with one command using sed

If you provide an example of the output you expect, somebody may be able to help you.

It is really tough to understand. Could you please explain me How didi you do that. I was applying a logic :
1). cut the line with the delimiter ".sql" and take the first field.(e.g spool $DATA/cim1021m)
2). convert all "/" to spaces and then (spool $DATA cim1021m)
3).delete everything till the last space(cim1021m)

If the input file is
"
@$SCRIPT/atp_asrmt_adj.sql
$SCRIPT/dba2000.scr -s / @$SCRIPT/cim1005w.pls
$SCRIPT/dba2000.scr -s / @$SCRIPT/cim1006w.pls
start $SCRIPT/cim1020d.sql;^M
spool $DATA/cim1021m.sql
@$DATA/cim1021m.sql
! rm $DATA/cim1021m.sql
spool $DATA/cim1021m.sql
@$DATA/cim1021m.sql
! rm $DATA/cim1021m.sql
"
Then the output file must be

"
atp_asrmt_adj
cim1005w
cim1006w
cim1020d
cim1021m
cim1021m
cim1021m
cim1021m
cim1021m
cim1021m

"

awk 'BEGIN{ FS="[/ ]"}{print $NF} ' file

You can do it using sed, awk and other.
The idea is to parse this line by line and to remove prefix and postfix.
In ksh following syntax:
line="${line#xxx}"
is "remove trailing string "xxx" from the variable line. if not possible to remove then return me the string unmodified. then assign result to line".
# : remove trailing part
## : remove trailing part (as much as possible)
% : similar but for ending part
%% : similar

Example:
x='aaabbb'
"${x#a}" is 'aabbb'
"${x##a}" is 'bbb'

sed should handle this best (however I had some bad experience with lines longer than 255 chars in sed). Just tell him to remove replace {prefix_pattern}{?}{postfix_pattern} and replace it with {?}.
Sory, but I don't remember exactly what was the syntax in sed.

In example given by me you can see:

line="${line##/|\ }"
This is "remove prefix". And prefix is a pattern: '/' or ' '

line="${line%.pls}"
This is "remove postfix". And postfix is '.pls'. Just replace this with a pattern and you have it.
To pass the data for 'read -p' you could use
cat file |&