Print the first line and lines with "f" as the third "," separated field in "input" and format the result as a "," delimited table
awk -F, '{ if (NR == 1)print}{if($3 == "f")print}' input | column -t -s,