I write some expect scripts by connecting to a remote host through serial connection.
My problem is that the output of the spawned process (enabled with log_user 1
) contains DOS-style endings (each line being terminated with ^M
when reading logs in VIM).
I normally run dos2unix
on all logs at the end of the expect session, to get rid of them. Can the conversion be done in real time?
It turned out the problem is really simple.
What I am doing with my scripts is calling them like below:
As told in the description,
mylog
contains^M
line-endings when opened in Vim or usingcat -v mylog
.To get rid of them in real-time, I just call now: