#!usr/bin/perl -w use strict; while() { next if /^\s$/; # skip blank lines my ($SAMPLE_NAME, $SIZE) = (split /\s+/)[1,3]; # print line if $SIZE isn't numeric, e.g. "SIZE" # or if it is a number, then must meet min, max criteria if ($SIZE =~ /^[^0-9-.]/ or ( $SIZE > 2 and $SIZE <5)) { print "$SAMPLE_NAME $SIZE\n"; } } =prints SAMPLE_NAME SIZE U7345 4.333 =cut __DATA__ ID SAMPLE_NAME EFFECTS SIZE 001 U7654 NEGATIVE 5.666 002 U7345 POSITIVE 4.333 003 U7674 NEGATIVE 1.696 002 U7845 POSITIVE -4.333