3

What is an equivalent of memmove on files with the same input and output file, which works with large files?

dd works when I move the file contents towards the right, but not if I move the contents left, since there's no handling of overlap.

ddrescue has a reverse copy, but refuses to work on the same input & output file.

simonzack
  • 723

1 Answers1

0

beav is a visual binary editor with commands similar to emacs that can edit binary files. The sequence you would use to move a block would run along the lines of :

  • find start of block and set mark ESC.
  • go to to end of block and delete-mark-to-cursor (contents stored in kill-buffer)CTRL-W
  • go to where you want the block moved to and yank CTRLY
  • file-save CTRL-XCTRLS
  • quit CTRL-XCTRLC

Here's the Debian beav package description.

Extract

With beav, you can edit a file in HEX, ASCII, EBCDIC, OCTAL, DECIMAL, and BINARY. You can display but not edit data in FLOAT mode. You can search or search and replace in any of these modes. Data can be displayed in BYTE, WORD, or DOUBLE WORD formats. While displaying WORDS or DOUBLE WORDS the data can be displayed in INTEL's or MOTOROLA's byte ordering. Data of any length can be inserted at any point in the file. The source of this data can be the keyboard, another buffer, or a file. Any data that is being displayed can be sent to a printer in the displayed format. Files that are bigger than memory can be handled.

X Tian
  • 10,463
  • Does beav work with large (multi-terabyte) copy pastes without filling up ram? – simonzack Mar 21 '14 at 10:12
  • You should edit your original question and add that pertinent piece of information. I've added an extract, but haven't tried it with files that large. sorry – X Tian Mar 21 '14 at 10:30