perl,可能功力不够,略长- open READ,"<:raw","a.txt";
- open WRT,">:raw","b.txt";
-
- print WRT scalar(<READ>);
- my @all = <READ>;
-
- for my $i (0 .. $#all-1)
- {
- $all[$i] =~/([\d\.]+)\s+/;
- $dpa = $1;
- $all[$i+1] =~/([\d\.]+)\s+/;
- $dpb = $1;
-
- printf(WRT $all[$i]);
- for (my $n = $dpa+0.01; $n < $dpb; $n+=0.01)
- {
- printf(WRT "%.2f -999.25\r\n", $n);
- }
- }
- printf(WRT $all[$#all]);
-
- close READ;
- close WRT;
复制代码
|