I’m trying to compare files ignoring carriage returns – which diff -b on any other unix performs admirably. But on this AIX 5.3 box:
tst1:tst2$ od -c testfile
0000000 t h i s \r \n f i l e \r \n h a s \r
0000020 \n c a r r i a g e \r \n r e t u r
0000040 n s \r \n
0000044
tst1:tst2$ od -c testfile_nocr
0000000 t h i s \n f i l e \n h a s \n c a
0000020 r r i a g e \n r e t u r n s \n
0000037
tst1:tst2$ diff -b testfile testfile_nocr
1,5c1,5
< this
< file
< has
< carriage
< returns
---
> this
> file
> has
> carriage
> returns
tst1:tst2$
Why so?
AIX 5.3 diff does not appear to consider
\ras white space. See the following transcript:The manpage for
diffis a little obtuse on the matter, stating that-bwill “cause any amount of white space at the end of the line to be treated as a single newline character …” but does not actually define what it considers to be white space.Based on the above transcript, I would gather that spaces and tabs are okay but carriage returns are not.
One way to get around this will be to remove the carriage returns yourself with a script like:
Alternatively, you could compile the GNU
diffutility on your box and insert it into the path before/usr/bin– it appears to have no trouble with\ras white space. In fact, we do exactly that on our AIX4 boxes sincediffthere doesn’t even pretend to support the-boption.