my @lines = $=finish.lines; # 每隔 5 行合并成 1 行 say @lines[0]; .say for @lines[1..(*-2)].rotor(5)».join(";"); say @lines[* - 1]; =finish =================================== 11111111111 22222222222 33333333333 44444444444 55555555555 66666666666 77777777777 88888888888 99999999999 00000000000 ....................................... # 找出前后两条数据的时间戳大于 10s 的数据 .say if (.max - .min > 10000) for $=finish.lines.sort.rotor(2 => -1); #(.max - .min).say for $=finish.lines.sort.rotor(2 => -1); =finish 1574220765000 1574220775000 1574220785000 1574220795000 1574220805000 my @a = $=finish.lines.sort; for @a.keys.rotor(2 => -1) -> ($m, $n) { my $ts_diff = (@a[$n] / 1000 - @a[$m] / 1000) ; say "@a[$m], @a[$n] = $ts_diff" if $ts_diff >= 15 * 60; } =finish 1529078405000 1529078415000 1529078425000 1529078435000