Compare value of a column in a file

i have a file which has few columns.From those columns i need to check the value of column 9 if it is 1 or not.If it is 1 then only i need to print column 4,5,7,9.

 
Sample input.
 
Column 1,Column 2,Column 3,Column 4,Column 5,Column 5,Column 6,Column 7,column 8,Column 9,Column 10.
 
Heading 1
value 1h,Value 2h,,value 4h,value 5h,Value 6h,Value 7h,Value 8h,1,value 10h
 
Heading 2
value 1b,Value 2b,,value 4b,value 5b,Value 6b,Value 7b,Value 8b,0,value 10b
 
Heading 3
value 1c,Value 2c,,value 4c,value 5c,Value 6c,Value 7c,Value 8c,1,value 10c
 
Output
 
Column 4,Column 5,Column 7,Column 9
value 4h,value 5h,Value 7h,1
value 4c,value 5c,Value 7c,1

In the above input heading 1,heading 2 and heading 3 are various headings in the file.

Also first column header start from line 3 in the file.

$ awk -F, '$9==1{print $4,$5,$7,$9}' OFS=, input
value 4h,value 5h,Value 7h,1
value 4c,value 5c,Value 7c,1

hi..Thanks for the reply.
but input value can be anything..There are more than 1000 records in the file in a similar pattern.There should be some loop etc.
I dont want to hardcode the input values.

What input value? ... Your problem description is no longer clear to me at all.

The input file has 1000 records of similar pattern as the sample input file that I have given.

However in the script you are hard coding the input values as below
print $4,$5,$7,$9}' OFS=, input
value 4h,value 5h,Value 7h,1
value 4c,value 5c,Value 7c,1

I think there should be some loop which take the values from input .csv file and then redirect the output based on search critaria(where column 9 has value 1) to some output file.

No! The script neutronscott gave you was:

awk -F, '$9==1{print $4,$5,$7,$9}' OFS=, input

which specifies that the input field separator is comma ( -F, ), the output field separator is comma ( OFS=, ), and for every line in your input file (you didn't say what the name was, but this code assumes that the input file is named input ) if the ninth field is 1 ( $9==1 ) it will print the 4th, 5th, 7th, and 9th fields ( print $4,$5,$7,$9 ). Then he showed that with the input you supplied, it produces the output:

value 4h,value 5h,Value 7h,1
value 4c,value 5c,Value 7c,1

which is exactly what you asked for. If you have a different name for your input file change input in the script to the name of your input file. If you want to save the output in a file, add

 > your_desired_output_filename

to the end of the awk command.

This command wil work just fine with zero lines of input or as many input lines as are present in any csv file you give it (as long as you have space to store the output in the file to which you redirect output and input lines are no longer than LINE_MAX bytes for whatever value LINE_MAX is on your system).