Can someone help me tweak this regex? It's grabbing 72.49 GB
and I'm ONLY interested in the value 72.49
$line =~ m/(backup-size)[:=](.+)/
Raw String:
Tue Jan 04 05:45:34 2011: db2.mil.mad:backup:INFO: backup-size=72.49 GB
Try this:
$line =~ m/backup-size[:=]([\d.]+) GB/;
To select both the size and the unit in separate groups:
$line =~ m/backup-size[:=]([\d.]+) (.B)/;
$line =~ m/backup-size[:=](\d+\.?\d*)\s*[KMG]B/i;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.