FixedRecordReverse[inFile_File, outFile_File, length_ : 80] := Module[{inStream, outStream, line, byte}, WithCleanup[ inStream = OpenRead[inFile, BinaryFormat -> True]; outStream = OpenWrite[outFile, BinaryFormat -> True]; , While[True, line = {}; Do[ byte = BinaryRead[inStream, "Byte"]; AppendTo[line, byte] , length ]; If[byte === EndOfFile, Break[]]; line = Reverse[line]; BinaryWrite[outStream, line] ] , Close[outStream]; Close[inStream]; ]; (* Verify the result *) RunProcess[{"dd", "if=" <> outFile[[1]], "cbs=" <> ToString[length], "conv=unblock"}, "StandardOutput"] ];