The parity-violating effective action for theories of fermions coupled to external gauge fields in arbitrary odd dimensions is calculated exactly by a perturbative technique. This effective action is used to obtain the structures for the Chern-Simons terms in odd dimensions and anomalies in even dimensions. Our analysis clearly elucidates the connection of the Chern-Simons terms with the covariant and consistent anomalies.