bash$ ed textfile.txt < commandfile
bash$ ed textfile.txt <<EOFaThis is now the last line..wqEOF
bash$ ed textfile.txt <<EOFg/re/pqEOF