i have two files , one is var.txt and another res.dat file
var.txt contains informaton like below
date,request,sales,item
20171015,1,123456,216
20171015,1,123456,217
20171015,2,345678,214
20171015,3,456789,218
and res.dat contains is a one huge file contains information like below
RTCCVB01 213456 123456 216
.
.
.
.
.
.
VBPCVB01
RTCCVB01 213456 345678 214
.
.
.
.
.
.
VBPCVB01
RTCCVB01 213456 123456 217
.
.
.
.
.
.
VBPCVB01
RTCCVB01 213456 456789 218
.
.
.
.
.
.
VBPCVB01
For a unique request i have to create a separate dat file, for example
for Request 1
123456.dat
RTCCVB01 213456 123456 216
.
.
.
.
.
.
VBPCVB01
RTCCVB01 213456 123456 217
.
.
.
.
.
.
VBPCVB01
for Request 2 345678.dat
RTCCVB01 213456 345678 214
.
.
.
.
.
.
VBPCVB01
for Request 3 456789.dat
RTCCVB01 213456 456789 218
.
.
.
.
.
.
VBPCVB01
sales occur at 50-56 position in res.dat file item occur at 72-79 position in res.dat file
i have to write a shell script which will do below for each unique request from var.txt it will take sales and item and extract information from res.dat and will be creating separate dat files till all request number is done .