Cat command not working to display Mac file in Ubuntu

Hi,

Recently I got a .txt file from Mac user. when I try to open it in my Ubuntu machine using cat command it is not displaying any content of file however I can see the content using vi.

Anyone know How to see its content using cat as I have to process it in my shell script.

Thanks in Advance.

When you use vi, do you see a regular ASCII file or something else?

At the bottom left it is [mac] and at the right side bottom it is ALL written in vi.

---------- Post updated at 11:34 AM ---------- Previous update was at 11:33 AM ----------

May be I should use dos2unix or recode or iconv but I am not sure about it.

I don't think dos2unix would work, as it is mac to unix.
I guess it contains short lines only? Due to the <CR> line terminator, it will print all lines into the current line, overwriting the recent lines, and then finally overwrite that with your command prompt. Try tr '\r' '\n' < file.txt

1 Like

Thanks Now I got it. With your command I can put the content of file in some temp file before opening it with cat.