This is the illustration diagram for the calculation of electric field due to line charge at point P.
Let us consider a charge is uniformly distributed along the line of length 2l.
The distance between the point ‘O’ to point ‘P’ is x.
The electric field at point P due to small length dl is dE. And the small length dl have charge dq.
Reference Source:
[1] Electric field due to an infinite wire. Youphysics.education. Published 2022. Accessed February 23, 2022. https://www.youphysics.education/electric-field-continuous-distribution/field-wire/
[2] Electric Field, Cylindrical Geometry. Gsu.edu. Published 2022. Accessed February 23, 2022. http://hyperphysics.phy-astr.gsu.edu/hbase/electric/elecyl.html#:~:text=The%20electric%20field%20of%20an,cylinder%20and%20is%20directed%20outward.
[3] Pandey, DC. Understanding Physics for JEE Main and Advanced. Meerut, Arihant.