[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+$/
data = line.split
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
On Tue, Nov 17, 2020 at 05:00:45PM +0800, Luan Shengde wrote:
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*$/
good idea!
Thanks, Kaiyi
Thanks, Luan Shengde
data = line.split
2.23.0
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
previous line should be aligned to "iozone".
but cannot match the line as below(there are extra spaces after '2892445'):
64 4 1599680 3057153 4274062 4897948 3588436 2892445
ditto.
Thanks, Zhangyu
[how] Add line.rstrip! before match