Listing 3.
#----------------------------------------
ex -s $TARGET >/dev/null <<E_O_F
1
/three/
a
This line is added after the first line containing three.
.
wq!
E_O_F
#----------------------------------------
ex -s $TARGET >/dev/null <<E_O_F
1
/three/
i
This line is added before the first line containing three.
.
wq!
E_O_F
#----------------------------------------
ex -s $TARGET >/dev/null <<E_O_F
$
a
This line is added at the bottom of the file.
.
wq!
E_O_F
Copyright © 1994 - 2019 Linux Journal. All rights reserved.