ESP Scalpel is a fast and powerful command line tool for performing surgery
on ESP file elements. While primarily intended for modders familiar with
ESP file internal structures, it is suitable for anyone as an exploration
and learning tool who isn't afraid of command line operation or hexadecimal
output. A demonstration is included in the form of a batch file that shows
it being used to extract an NPC from skyrim.esm, rename it, modify its AI
packages and inventory, and drop it into the Bannered Mare inn as a new NPC.
A manual and walkthrough of the NPC extraction process is included, as well as C source code with a license allowing its free use and redistribution in personal projects and commercial products alike. C source code to load ESP or ESM files, break their groups down into linked lists of decompressed records and subrecords, perform a variety of modifications on them, and reassemble and recompress the record chains and output new ESP files is provided in the download.
Current version is 12-03-13, available here
If the -h switch is used, scalpel becomes a command line hex editor for arbitrary files. Insert, overwrite, and delete operations can be performed on non-ESP files, including executables.