sed

Edit text in a scriptable manner. See also: awk, ed. More information: https://man.openbsd.org/sed.1.

command | sed 's/apple/mango/g'

command | sed -f path/to/script.sed

command | sed -fa path/to/script.sed

command | sed -E 's/(apple)/\U\1/g'

command | sed -n '1p'

sed -i 's/apple/mango/g' path/to/file