Re: How do I find out if a text file includes currently Windows CRs or is Linux compatible?



Wed, 12 Dec 2007 12:52:46 +0000, Karl Medrell did cat :

I have transferred a text file from WinXP to Linux. I am not sure if my
ftp client automatically converted the Carriage returns to Unix style.

How can I find out (on the Linux) system if a text file is cuurently
Linux conform?

If I simply type:

cat /home/myname/myfile

it looks always good. But sometimes Win CRs are included anyhow.

Karl

Of course it is scriptable but I'd recommend the 'file' command:

given those sample files:
:~>: xxd /dev/shm/toto2
0000000: 610a 620a 630a a.b.c.
:~>: xxd /dev/shm/toto3
0000000: 610d 0a62 0d0a 630d 0a a..b..c..

and, the winner is:
:~>: file /dev/shm/toto2 /dev/shm/toto3
/dev/shm/toto2: ASCII text
/dev/shm/toto3: ASCII text, with CRLF line terminators
.


Quantcast