good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
match search string with column header, do some filtering with matched column, print lines/rows that match filter criteriaby dkhalfe (Acolyte) |
on Jul 26, 2012 at 20:42 UTC ( [id://983933]=perlquestion: print w/replies, xml ) | Need Help?? |
dkhalfe has asked for the wisdom of the Perl Monks concerning the following question: hi all
Gameplan: I am going to read in a filter_file and an input file.
Filter file will be tab-delim formatted as such:
Input file will be tab-delim formatted as such:
My code:
The part I need help with concerns the bottom of my code:
NOTE: above code translates to: if values in col 'a' are '<=' to '.3', print value (those that match the criteria).
I need to match the column header of my input file with one designated in the filter file. Which I do here: last if $header_line =~ m/$search_string/; Then I need to make the comparison designated in the filter file. Ex: Match 'a' (column header) with 'a' in input file, if values in col 'a' are <= .3, print to OUTFILE. Which is done here: My problem: If the values in col 'a' are <= .03, I need to print the entire row of the input file to the output file, not just the value from the column I am working with. Any help with this issue would be much appreciated. Thanks.
Back to
Seekers of Perl Wisdom
|
|