Please help me figure out whats wrong with my code,
I have to split a file according to values in 3rd thru 6th column,
If the 3rd or 4th col values are >0, row goes to 1 file, if 3rd and 5th are >0,row goes to another file...and so on...
What is wrong with my code? It doesn't seem to work. No error but no output either,
Sample input
chr7 16736 3 0 4 0
chr7 16737 4 0 4 0
chr7 16738 6 0 5 0
chr7 16739 6 0 5 0
chr7 16740 7 0 5 1
chr7 16741 8 0 5 1
chr7 16742 8 0 5 1
I tried.
awk -F"\t" '{
if( ($3 > '0') && ($4 > '0'))
{
print $0 >> "mat_filt1.txt"
}
if( ($3 > '0') && ($5 > '0'))
{
print $0 >> "mat_filt2.txt"
}
if( ($3 > '0') && ($6 > '0'))
{
print $0 >> "mat_filt3.txt"
}
if( ($4 > '0') && ($5 > '0'))
{
print $0 >> "mat_filt4.txt"
}
if( ($4 > '0') && ($6 > '0'))
{
print $0 >> "mat_filt5.txt"
}
if( ($5 > '0') && ($6 > '0'))
{
print $0 >> "mat_filt6.txt"
}
} '