Listing 2.

#!/bin/sh
PATH=/usr/bin:/bin:/usr/etc:/usr/sbin:/sbin:/usr/local/bin
export PATH
TARGET=listing_1
ex -s $TARGET >/dev/null <<E_O_F
1
/three/d
wq!
E_O_F