开发者

help with regex in perl

开发者 https://www.devze.com 2023-04-05 23:34 出处:网络
Can someone help me get the correct regex for this string? Total14,9283,967 I am trying to remove that line using this, but no luck:

Can someone help me get the correct regex for this string?

Total                       14,928  3,967

I am trying to remove that line using this, but no luck:

shift @lines if $li开发者_如何学Cnes[0] =~ /^Total/;

Its also the last line of the output file.


What you might consider instead is:

@lines = grep !/^Total/, @lines;

If it is always the last line:

splice @lines, -1, 1 if $lines[-1] =~ /^Total/;

-1 is the last element in the array.

Or, more simply, as ikegami pointed out:

pop @lines if $lines[-1] =~ /^Total/;
0

精彩评论

暂无评论...
验证码 换一张
取 消