On Tue, Nov 17, 2020 at 04:48:27PM +0800, Lu Kaiyi wrote:
[why] iozone can match the line like:
64 4 1599680 3057153 4274062 4897948 3588436 2892445 2772930 3057153 3958892 3057153 3022727 3363612 4564786
but cannot match the line as below(there are extra spaces after '2892445'):
64 4 1599680 3057153 4274062 4897948 3588436 2892445
[how] Add line.rstrip! before match
Signed-off-by: Lu Kaiyi 2392863668@qq.com
stats/iozone | 1 + 1 file changed, 1 insertion(+)
diff --git a/stats/iozone b/stats/iozone index 9f7ee72f..ff389c48 100755 --- a/stats/iozone +++ b/stats/iozone @@ -8,6 +8,7 @@ per_record = {} all_sum = 0 nr_records = 0 while (line = STDIN.gets)
- line.rstrip! next unless line =~ /^\s*\d+.*\d+$/
for your update, there may be white space characters both at the head and tail of the line, avoid strip single side and reguler match the other side
update as: line.strip! next unless line =~ /^\d+.*\d+$/ or next unless line =~ /^\s*\d+.*\d+\s*$/
Thanks, Luan Shengde
data = line.split
2.23.0