How do i determine what the end of the line character is in a text file. for eg. is it \n or \f or \t etc..
Is there a unix command for this?
How do i determine what the end of the line character is in a text file. for eg. is it \n or \f or \t etc..
Is there a unix command for this?
I'd do something like
head -1 myfile | od -ta
For a DOS file, you get
0000000 m y l i n e cr nl
(cr = \r, nl = \n)
For a UNIX file, you get
0000000 m y l i n e nl
Cheers
ZB
file(1) will tell you, too.
thank you
AbEnd,
I didnt get it how you give your command on the file?
To quote from a manual page for a version of file included with recent Linux
At the command prompt....
For a standard UNIX file (LF (i.e. \n) terminators)
$ file my_file
my_file: ASCII text
For a DOS file ( \r\n terminators )
$ file my_file
my_file: ASCII text, with CRLF line terminators
Cheers
ZB