Several applications, such as optical tweezers and atom guiding, benefit from techniques that allow the engineering of spatial field profiles, in particular their longitudinal intensity patterns. In cylindrical coordinates, methods such as frozen waves allow an advanced control of beam characteristics, but in Cartesian coordinates there is no analogous technique. Since Cartesian beams may also be useful in applications, we develop here a method to modulate on demand the longitudinal intensity pattern of any (initially) unidimensional Cartesian beam with concentrated angular spectrum (thus encompassing all unidimensional paraxial beams) in lossless and lossy media. To this end, we write the total beam as a product of two unidimensional beams and explore the degree of freedom provided by the additional Cartesian coordinate. While in the plane where this coordinate is zero the chosen unidimensional beam keeps its structure with the additional desired intensity modulation, a sinusoidal-like oscillation appears in the direction of this variable and creates a spot whose size is tunable. Examples with Gaussian and Airy beams are presented and their corresponding experimental demonstrations in free-space are performed to show the validity of the method.