Reputation: 22731
This has been asked a dozen times already, but the answer is always "see what type of file vi says it is and deduce from that" or "run it through cat and see if the windows line endings are rendered" or "run it through egrep to see if egrep finds instances of one type of line ending or another".
Is there not a reasonably easy way to just directly view which characters are used? Ideally I would just have a flag on cat that spat out escape characters in their human-readbable representation instead of rending them as whitespace.
Upvotes: 2
Views: 2873
Reputation: 41
You can also use "cat -v", it doesn't show everything but it does show "\r\n" as "^M":
$ cat -v WKB2.gff | head
##gff-version 2^M
# seqname source feature start end score strand frame attributes^M
CP007446 - source 1 2527978 . + . organism "Snodgrassella alvi wkB2" ; mol_type "genomic DNA" ; strain "wkB2" ; db_xref "taxon:1196094"^M
$ cat -v PAO1.gff | head
##gff-version 3
#!gff-spec-version 1.20
#!processor NCBI annotwriter
##sequence-region AE004091.2 1 6264404
##species http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id=208964
AE004091.2 Genbank region 1 6264404 . + . ID=id0;Dbxref=taxon:208964;Is_circular=true;gbkey=Src;genome=chromosome;mol_type=genomic DNA;strain=PAO1
Upvotes: 4
Reputation: 88175
head -1 file.txt | hexdump -C
Look at the last bytes printed out and you should be able to tell what the line endings are.
Upvotes: 2