in reply to remove 16 Zeros

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 ...

Ron

Replies are listed 'Best First'.
Re^2: remove 16 Zeros
by Anonymous Monk on Oct 14, 2015 at 06:46 UTC

    Oh yeah. that works fine. I have to find out about 1000 PVID's from DISKS. So i list DISKS and read the Configuration of DISK's, where i must grep the string pvid and filter only he pvid.

    So this is the better solution.

    thank u Ron :-)