commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
$ prepend content to add [filename]
Uses ed, so no temp files created.
Nth line of a file - dirty hack way. I haven't used ed in ages ;-)
also works in vim
In Redhat, xmlstarlet is called just xml which can be found in xmlstarlet RPM.