What have you tried so far?
The examples you give can be easily done with SED. For example, to delete a specific phrase---eg "/export/home", you would do this:
sed 's%/export/home%%' <filename >newfilename
This uses the SED substitution command, with "%" as the delimiter. The general syntax is "s%old%new%". In this case, I chose "%" as the delimiter so there would not be a conflict with the "/" in the actual test. ("/" is the delimiter seen most often in the SED documentation.)
To remove the last line, you can use SED, CUT, and probably several others.
Best SED tutorial here:
http://www.grymoire.com/Unix/Sed.html
Bash tutorials:
http://tldp.org