Perl regular expressions can count as explained in perlretut - Perl regular expressions tutorial in the section on on matching repetitions. So /0{16}/ matches exactly 16 zeroes.
use strict; use warnings; my $line = "pvid 00c1be9a467335ce0000000000000000"; my $pvid; if ($line =~ /pvid\s+(.*)0{16}$/) { $pvid = $1 } print "$pvid\n"; __END__ 00c1be9a467335ce
Since the string you are trying to extract consists of hex digits, a slight improvement on the regex might be: /pvid\s+([[:xdigit:]]*)0{16}$/ . Go to perldoc.perl.org and search for "character class" to learn more ...
In reply to Re: remove 16 Zeros
by mr_ron
in thread remove 16 Zeros
by eghdam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |