in reply to Re^4: Combined lines from a file into one
in thread Combined lines from a file into one

Yes, if you mean like this
my $type = 'IMB'; my $version = 'V1'; s/^($type,\d+,$version\s+,)(\d+),\K (?:.*\n)+ \1\d+,(\d+).*/$3/gmx;

or do you mean the file contains records other than IMB,V1 ?
poj