Given $I =\int e^x (\frac{1}{x}-\frac{1}{x^2})dx$
Clearly if f(x)=$\Large\frac{1}{x}$
Let us take $f(x)=\Large\frac{1}{x}$
$f(x)=\large \frac{1}{x}$$=x^{-1}$
Then on differentiating w.r.t.x we get
$ f'(x)=-x^{-2}$
$\qquad =-\large \frac{1}{x^2}$
Hence this of the form $\int e^x[f(x)+f'(x)dx]=e^xf(x)+c$
therefore $\int e^x[f(x)+f'(x)]dx=e^x.\large \frac{1}{x}$$+c$
$\qquad =\large \frac{e^x}{x}$$+c$