APPROACH $1$:
Using contour integration we begin by writing the integral of interest as
$$\int_0^\infty \frac{\cos(x)-e^{-x}}{x}\,dx=\text{Re}\left(\int_0^\infty \frac{e^{ix}-e^{-x}}{x}\,dx\right) \tag 1$$
Next, we note that from Cauchy's Integral Theorem
$$\oint_C \frac{e^{iz}-e^{-z}}{z}\,dz=0 \tag 2$$
where $C$ is the closed contour comprised of (i) the line segment from $\epsilon>0$ to $R$, (ii) the quarter circle of radius $R$ centered at the origin from $R$ to $iR$, (iii) the line segment from $iR$ to $i\epsilon$, and (iv) the quarter circle of radius $\epsilon$ centered at the origin from $i\epsilon$ to $\epsilon$.
We can write $(2)$ as
$$\begin{align}\oint_C \frac{e^{iz}-e^{-z}}{z}\,dz&=\int_\epsilon^R \frac{e^{ix}-e^{-x}}{x}\,dx+\int_R^\epsilon \frac{e^{-y}-e^{-iy}}{iy}\,i\,dy\\\\
&+\int_0^{\pi/2}\frac{e^{iRe^{i\phi}}-e^{-Re^{i\phi}}}{Re^{i\phi}}\,iRe^{i\phi}\,d\phi\\\\
&+\int_{\pi/2}^0\frac{e^{i\epsilon e^{i\phi}}-e^{-\epsilon e^{i\phi}}}{\epsilon e^{i\phi}}\,i\epsilon e^{i\phi}\,d\phi\tag 3
\end{align}$$
As $R\to \infty$ and $\epsilon \to 0$, the third and fourth integrals on the right-hand side of $(3)$ can be shown to approach zero. Using $(2)$, we see that
$$\int_0^\infty \frac{e^{ix}-e^{-x}}{x}\,dx=-\int_0^\infty \frac{e^{-iy}-e^{-y}}{y}\,dy \tag 4$$
whence taking the real part of both sides of $(4)$ and comparing with $(1)$ yields
$$\int_0^\infty \frac{\cos(x)-e^{-x}}{x}\,dx=-\int_0^\infty \frac{\cos(x)-e^{-x}}{x}\,dx$$
Therefore, we find that
$$\int_0^\infty \frac{\cos(x)-e^{-x}}{x}\,dx=0$$
________________________-
APPROACH $2$:
An alternative suggested by Ron Gordon, is to start with the integral
$$\oint_{C}\frac{e^{iz}}{z}\,dz=0$$
Then, we can write
$$\begin{align}
0&=\int_\epsilon^R \frac{e^{ix}}{x}\,dx+\int_R^\epsilon \frac{e^{-x}}{x}\,dx+i\int_0^{\pi/2} e^{iRe^{i\phi}}\,d\phi+i\int_{\pi/2}^0 e^{i\epsilon^{i\phi}}\,d\phi\\\\
&=\int_{\epsilon}^R\frac{e^{ix}-e^{-x}}{x}\,dx+i\int_0^{\pi/2} e^{iRe^{i\phi}}\,d\phi+i\int_{\pi/2}^0 e^{i\epsilon^{i\phi}}\,d\phi\tag 5
\end{align}$$
As $R\to \infty$, the third integral on the right-hand side of $(5)$ approaches $0$. As $\epsilon \to 0$ the fourth integral on the right-hand side approaches $-i\pi/2$. Therefore,
$$\int_0^\infty \frac{e^{ix}-e^{-x}}{x}\,dx=i\pi/2 \tag 6$$
Taking real and imaginary parts of $(6)$ yield respectively
$$\int_0^\infty \frac{\cos(x)-e^{-x}}{x}\,dx=0$$
and
$$\int_0^\infty \frac{\sin(x)}{x}\,dx=\frac{\pi}{2}$$