Corollary 7.9. Let a function $f: \mathbb{R} \rightarrow \mathbb{C}$ be integrable with respect to a Lebesgue-Stieltjes measure $\mu$ . Then for any $\varepsilon>0$, there is a continuous function g which vanishes outside a finite interval such that$\int_{\mathbb{R}}|f-g| d \mu<\varepsilon $.
Proof. It suffices to prove the claim for real functions f. Fix $\varepsilon>0$ and let $\phi=\sum_{j=1}^{N} a_{j} 1_{E_{j}}$ be a simple function from the previous proposition such that $\int_{\mathbb{R}}|f-\phi| d \mu<\varepsilon / 3$.
Let $M:=\max _{j=1, \ldots, n}\left|a_{j}\right|$ be the supremum of $|\phi|$ . For each $j$, there is a compact set $F_{j} \subseteq E_{j}$ with$\mu\left(E_{j} \backslash F_{j}\right)<\varepsilon /(3 M N)$ .Now we define the simple function $\psi=\sum_{j=1}^{N} a_{j} 1_{F_{j}}$ ; then$\int_{\mathbb{R}}|\phi-\psi| d \mu=\sum_{j=1}^{N} \mu\left(E_{j} \backslash F_{j}\right)\left|a_{j}\right| \leqslant N M \cdot \varepsilon /(3 M N)=\varepsilon / 3$
Let $V>0$ be such that $\bigsqcup_{j=1}^{N} F_{j} \subseteq[-V, V]$ and set $F_{0}=\{-V-1, V+1\}$ . We construct $g:[-V-1, V+1] \rightarrow[-M, M]$ by starting with $g(x)=a_{j}$ for $x \in F_{j}$ and $g(-V-1)= g(V+1)=0$ .Now the set$U=[-V-1, V+1] \backslash \bigsqcup_{j=0}^{N} F_{j}$is open and thus can be written as $\bigsqcup_{k=1}^{\infty}\left(a_{k}, b_{k}\right)$ . Note that we have already defined $g$ at all the points $a_{k}, b_{k}, k \geqslant 1$. Then we can define $g$ on each interval $\left(a_{k}, b_{k}\right)$ in such a way that it will be piecewise linear, continuous on $\left[a_{k}, b_{k}\right]$ and $\int_{a_{k}}^{b_{k}}|g-\psi| d \mu<(\varepsilon / 3) \cdot 2^{-k}$
Finally, define $g(x)=0$ for $|x| \geqslant V+1$ . Then g is continuous function on the real line, and, since $g(x)=\psi(x)$ for $x \notin U$ ,$\int_{\mathbb{R}}|\psi-g| d \mu=\sum_{k=1}^{\infty} \int_{a_{k}}^{b_{k}}|g-\psi| d \mu<\varepsilon / 3$.
Question: Since $g$ is not zero on $a_k,b_k$, but $\phi = 0 \ $when $x\in (a_k,b_k)$. I don't know how to ensure the setting "Then we can define $g$ on each interval $\left(a_{k}, b_{k}\right)$ in such a way that it will be piecewise linear, continuous on $\left[a_{k}, b_{k}\right]$ and $\int_{a_{k}}^{b_{k}}|g-\psi| d \mu<(\varepsilon / 3) \cdot 2^{-k}$" is true.