#!/usr/bin/perl -w use strict; system("pvscan>>pv.txt1"); open my $FH,"pv.txt1" or die "Cannot open file: $!"; while(my $line = <$FH>){ my $pvname = $line =~ /\[\d+\.\d+\sGB\s\/\s\d+\.\d+\sGB\]/i; print $pvname; }