comparing text files that lack line breaks (SuSE 10.0)
This is necessitated due to brain dead windoz software and a hard disk failure. I had saved an original file before working on the copy. The app refused to work with my copy, claiming a difference in format, even though I changed only one byte (a 0x34 "4" to a 0x30 "0"), and file file sizes are identical. Then the HD grew new bad sectors, and the original simply disappeared, and no undelete utils I could find could locate it to undelete it. So now I need to figure out from similar files and the copy what the format difference(s) is/are, but diff doesn't seem to care for files that lack line breaks. apropos didn't seem any help. I asked on IRC, where fold and ediff were suggested. ediff seemed the better choice, but bash couldn't find it. YaST claimed that patchutils provides ediff, so I directed YaST to install it. It claims to have done so, and an rpm query confirms it, but bash still can't find it, even running as root. Any suggestions? -- "Let us not become weary in doing good, for at the proper time we will reap a harvest if we do not give up." Galatians 6:9 NIV Team OS/2 ** Reg. Linux User #211409 Felix Miata *** http://mrmazda.no-ip.com/
Felix, On Saturday 19 August 2006 20:20, Felix Miata wrote:
...
So now I need to figure out from similar files and the copy what the format difference(s) is/are, but diff doesn't seem to care for files that lack line breaks. apropos didn't seem any help. I asked on IRC, where fold and ediff were suggested.
ediff seemed the better choice, but bash couldn't find it. YaST claimed that patchutils provides ediff, so I directed YaST to install it. It claims to have done so, and an rpm query confirms it, but bash still can't find it, even running as root.
I have patchutils installed, but there's no executable in an ordinary place called ediff. There are three such files, but they're all part of xemacs: % locate '*/ediff' /usr/share/xemacs/xemacs-packages/etc/ediff /usr/share/xemacs/xemacs-packages/lisp/ediff /usr/share/xemacs/xemacs-packages/man/ediff % rpm -q --whatprovides $( locate '*/ediff' ) xemacs-packages-20050715-3 xemacs-packages-20050715-3 xemacs-packages-20050715-3
Any suggestions?
Introduce line breaks at arbitrary points using fold and then use diff. % rpm -q --whatprovides /usr/bin/fold coreutils-5.3.0-20.2 Randall Schulz
On 06/08/19 21:36 (GMT-0700) Randall R Schulz apparently typed: Thank you, and Theo, for your replies.
Introduce line breaks at arbitrary points using fold and then use diff.
% rpm -q --whatprovides /usr/bin/fold coreutils-5.3.0-20.2
Fold was suggested to me early on, but from the description I got of ediff I thought that would be the better first try. Fold seemed easy enough to use. I tried it with -s and with --width=50. The result of both was that both diff and diff -u would simply report the files as different, which didn't help me any. Just guessing diff doesn't like the null bytes near the beginning of those files. For any who care, the 9 files are at http://mrmazda.no-ip.com/tmp/ named p991-* . The good files are 99 and 03. The bad are 01 and 02. I got lucky taking another look with a viewer in hex mode and figured out the difference that was causing the "save format different" error. Notepad was the editor I first tried to use to edit. I changed one byte, at 0x33e in the original file, from 0x34 to 0x30. For some inexplicable reason, notepad changed 4 other bytes in the file, 4 instances of 0x20 to 0x00, at 0x00F, 0x01F, 0x12F, and 0x13F. I fixed it using windoz and debug. What binary editors come with SUSE Linux for making simple edits to smallish binary files? -- "Let us not become weary in doing good, for at the proper time we will reap a harvest if we do not give up." Galatians 6:9 NIV Team OS/2 ** Reg. Linux User #211409 Felix Miata *** http://mrmazda.no-ip.com/
Mon, 21 Aug 2006, by mrmazda@ij.net: [..]
I fixed it using windoz and debug. What binary editors come with SUSE Linux for making simple edits to smallish binary files?
MC for in a terminal, khexedit for an app with GUI. Theo -- Theo v. Werkhoven Registered Linux user# 99872 http://counter.li.org ICBM 52 13 26N , 4 29 47E. + ICQ: 277217131 SUSE 9.2 + Jabber: muadib@jabber.xs4all.nl Kernel 2.6.8 + See headers for PGP/GPG info. Claimer: any email I receive will become my property. Disclaimers do not apply.
Sat, 19 Aug 2006, by mrmazda@ij.net:
So now I need to figure out from similar files and the copy what the format difference(s) is/are, but diff doesn't seem to care for files that lack line breaks. apropos didn't seem any help. I asked on IRC, where fold and ediff were suggested.
ediff seemed the better choice, but bash couldn't find it. YaST claimed that patchutils provides ediff, so I directed YaST to install it. It claims to have done so, and an rpm query confirms it, but bash still can't find it, even running as root.
patchutils.i586 0.2.30-4 base Matched from: Patchutils contains a collection of tools for manipulating patch files: interdiff, combinediff, filterdiff, fixcvsdiff, rediff, lsdiff, and splitdiff. No ediff there.
Any suggestions?
There are several programs on Freshmeat suitable for binary diffs and patches. -- Theo v. Werkhoven Registered Linux user# 99872 http://counter.li.org ICBM 52 13 26N , 4 29 47E. + ICQ: 277217131 SUSE 9.2 + Jabber: muadib@jabber.xs4all.nl Kernel 2.6.8 + See headers for PGP/GPG info. Claimer: any email I receive will become my property. Disclaimers do not apply.
Felix Miata wrote:
This is necessitated due to brain dead windoz software and a hard disk failure. I had saved an original file before working on the copy. The app refused to work with my copy, claiming a difference in format, even though I changed only one byte (a 0x34 "4" to a 0x30 "0"), and file file sizes are identical.
Then the HD grew new bad sectors, and the original simply disappeared, and no undelete utils I could find could locate it to undelete it.
So now I need to figure out from similar files and the copy what the format difference(s) is/are, but diff doesn't seem to care for files that lack line breaks. apropos didn't seem any help. I asked on IRC, where fold and ediff were suggested.
ediff seemed the better choice, but bash couldn't find it. YaST claimed that patchutils provides ediff, so I directed YaST to install it. It claims to have done so, and an rpm query confirms it, but bash still can't find it, even running as root.
Any suggestions?
If the failing drive is the one you're trying to recover the file from, DON'T!!! The last thing you want to do, is write to the drive that you're trying to recover data from. It's already flaky and writing will only make things worse. Get a new drive and install Linux on it. Then mount the bad drive and copy from it.
On 06/08/20 07:59 (GMT-0400) James Knott apparently typed:
Felix Miata wrote:
If the failing drive is the one you're trying to recover the file from, DON'T!!! The last thing you want to do, is write to the drive that you're trying to recover data from. It's already flaky and writing will only make things worse. Get a new drive and install Linux on it. Then mount the bad drive and copy from it.
Any particular reason why you assumed I didn't do any of that before writing? In fact, doze had virtually exclusive use of the bad hda, while Linux had exclusive use of hdc. As soon as I knew the disk was bad I cloned it to another, and I haven't booted from either the bad or the cloned ever since, waiting to resolve whether I can or must recover the lost file before allowing any new writes to either device. -- "Let us not become weary in doing good, for at the proper time we will reap a harvest if we do not give up." Galatians 6:9 NIV Team OS/2 ** Reg. Linux User #211409 Felix Miata *** http://mrmazda.no-ip.com/
participants (4)
-
Felix Miata
-
James Knott
-
Randall R Schulz
-
Theo v. Werkhoven