Updated September 29, 2004
Created September 29, 2004


Autogenerated Site Map
Search this Site!:
Search this site powered by FreeFind
Want to modify the middle of a file without messing with the rest of the file?

Let's say you have a 1MB file and some contents at offset 999335 (because you looked in xxd -g 1 and found it on offset line 999328 and was 7 entries over).

Here goes (just make sure you don't exceed the region you want to write to):

echo -n mynewstuff | dd of=my1MBfile bs=1 seek=999335 conv=notrunc

That's it. If you leave off conv=notrunc then your file gets truncated. If you use skip instead of seek then you'll wind up with a zero size file.

Now if I can just get this to work on /dev/mem or /dev/kmem then I'll be happy. Looks like I'll have to take the time to make a kernel module to do this for me.
Search this Site!:
Search this site powered by FreeFind

Homepage: http://www.cpqlinux.com
Site Map: http://www.cpqlinux.com/sitemap.html