bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: diff, diff -s, diff -sw , sdiff -s


From: Bob Proulx
Subject: Re: diff, diff -s, diff -sw , sdiff -s
Date: Fri, 11 Feb 2005 09:17:05 -0700
User-agent: Mutt/1.5.6+20040907i

Ramírez Sánchez-Escobar José Julio wrote:
> It shows lines as different, but the output is identical(?).

I suspect you may have line ending differences.  Some systems such as
GNU and UNIX systems use a single newline to indicate the end of
line.  Some other systems use a two character carriage return and
newline sequence to indicate an end of line.

> medusa1.cbm.uam.es 10% cat SEC_AA_NEW_9_4.pdb | cut -c35-37 > delme1 ; cat 
> SEC_AA_NEW_9_4_CO.pdb | cut -c35-37 > delme2 ; diff -s delme1 delme2

What does 'od -c' say about the files?  That should show the line
endings as either \n or \r\n escape sequences.

  od -c delme1 | head
  od -c delme2 | head

You may use 'tr' to remove those extra carriage returns and ctrl-z
characters from a file.

  tr -d '\015\032' < somefile1.txt > somefile2.txt

There are also a zillion other ways to do this too.  Using 'sed' (4.0
or later) can do the editing in place.  Or using perl similarly.

  sed --in-place 's/\r//' /tmp/testfile

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]