I am trying to understand the derivation of the Dirichlet Integral via complex integration (as outlined on wikipedia) but I have a problem with the last steps.
We consider $f(z) = \frac{e^{iz}}{z}$ and define $g(z) = \frac{e^{iz}}{z+i \epsilon}$ in order to move the pole away from the origin. Since for $g$ there are now no poles on the upper half of the complex plane we know by Cauchy's Residue Theorem that for $\gamma $ the semicircle of radius R centred at the origin $\int_\gamma g = 0$ i.e. $ 0 = \int_R^R \frac{e^{ix}}{x+i\epsilon} \, dx + \int_0^\pi \frac{e^{i(Re^{i\theta} + \theta)}}{Re^{i\theta}+i\epsilon} iR \, d\theta$
I see how the second term vanishes as $R \to \infty$ but I am not sure about the details of how to find $\int_R^R \frac{e^{ix}}{x+i\epsilon} \, dx = P.V.\;\int\frac{e^{ix}}{x}\,dx - \pi i \int_\mathbb{R} \delta(x) e^{ix}dx$ (P.V. indicating the Cauchy Principal Value) That is to say I do not understand how it follows from Sokhotski–Plemelj that the equation in the last line is true.