Вы можете использовать что-то подобное в perl -
Скрипт Perl:
#!/usr/bin/perl
undef $/;
$_ = <>;
$n = 0;
for $match (split(/(?=Rate)/)) {
open(O, '>temp' . ++$n);
print O $match;
close(O);
}
Выполнение:
[jaypal~/temp]$ ./spl.pl temp.file
[jaypal~/temp]$ **cat temp.file**
Line No. Main Text
1 Rate: GBP
2 12/01/1999,90.5911501,Validated
.....
.....
210 18/01/1999,90.954996,Validated
211 Rate: RMB
212 24/04/2008,132.2542,Validated
.....
1000 25/04/2008,132.2279,Validated
1001 28/04/2008,131.69915,Validated
1002 Rate: USD
1003 21/11/11,-0.004419534,Validated
[jaypal~/temp]$ cat temp1
Line No. Main Text
1
[jaypal~/temp]$ cat temp2
Rate: GBP
2 12/01/1999,90.5911501,Validated
.....
.....
210 18/01/1999,90.954996,Validated
211
[jaypal~/temp]$ cat temp3
Rate: RMB
212 24/04/2008,132.2542,Validated
.....
1000 25/04/2008,132.2279,Validated
1001 28/04/2008,131.69915,Validated
1002 [jaypal~/temp]$ cat temp4
Rate: USD
1003 21/11/11,-0.004419534,Validated
[jaypal~/temp]$