As we know by Gauss's law that
[tex]\int E.dA = \frac{q}{\epsilon_0}[/tex]
so for line charge the gaussian surface is cylindrical in shape
so we will have
[tex]E(2\pi RL) = \frac{\lambda L}{\epsilon_0}[/tex]
now by rearranging the terms
[tex]E = \frac{\lambda}{2\pi \epsilon_0 R}[/tex]
so here we will have to find the x component of electric field so it is given by above equation
[tex]E_x = \frac{\lambda}{2\pi \epsilon_0 x}[/tex]
here x = distance from the wire where we need to find electric field