can some one please explain to me how to do multiple if statements and nested if statements in an awk line? I am using the awk command in a CShell program.
My code:
awk '{split ($2,b,""); if (b[1-] == 1) {printf("%s%s%s\n","'$letter'","'$year2'")}}' fileRead >> $year$cmonth
My goal is to make this command have the if statement above with two more if statements nestled in it. Cmonth is just a counter of months from 1-12. Year2 is just a year. I can show an example of what I want in java because I know how to do it in java.
Java Code of what I desire:
if (b(some counter) == 1)
{
if (some counter < cmonth)
use year2
else if (some counter > cmonth)
use year3
else
fail
}
else
fail
Just have not been able to find the answer on the internet. Thanks for any help.