sed

Substitute on a glob of files

for file in *.glob
do 
  sed -i "s/\<word\>/replacement/g" $file
done

Remove a line from a file

sed -i "${LINENUMBER}d" $FILE
# where 0 < LINENUMBER

Insert a line into a file

sed -i "${LINENUMBER}iThe text to insert" $FILE
# where 0 < LINENUMBER

See bash-boilerplate.html for how to get the number of lines in a file