linux - Adding an || regex to a bash ``ed one-liner in a perl script -
i trying add || regex bash ``ed one-liner in perl script, if makes sense.
my $result = `df -h | grep -ve '^filesystem|tmpfs|cdrom|none' | awk '{ print \$1 "\t" \$5 " used."}'`; # .private maybe same /dev/sdb1 i'm trying remove # trying add || (m/\.private/) above print "$result";
so removing lines output start filesystem, tmpfs, cdrom or none, @ present, , "or lines containing .private" one-liner, if possible...
i have below also, want reproduce results above code...
my @result2 =shell::df ("-h"); shift @result2; # rid of "filesystem..." for( @result2 ){ next if ((/^tmpfs|tmpfs|cdrom|none/) || (m/\.private/)); @words2 = split('\s+', $_); print $words2[0], "\t", $words2[4], " used\.\n"; }
you need add \.private
part current regexp:
grep -ve '^filesystem|tmpfs|cdrom|none|\.private'
on side note, pattern ^filesystem|tmpfs|cdrom|none
might not want, filesystem
matched @ beginning of line, other parts matched if appear anywhere in input. match them @ beginning, change to:
'^filesystem|^tmpfs|^cdrom|^none'
Comments
Post a Comment