Trying out Slackware

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This thread has morphed in to discussing ways to convert line endings. 

I think the most portable tool is awk. I just love awk.

In the below one-liners, bns is the Braille 'N speak, or Macintosh; both use
only CR and not LF at the ends of lines:

from Unix to bns
  awk '{ gsub("\r", "\n"); print $0;}' macfile.txt > unixfile.txt

from bns to unix
  awk '{ gsub("\r", "\n"); print $0;}' macfile.txt > unixfile.txt

unix to Windows
  awk '{ sub("\r$", ""); print }' winfile.txt > unixfile.txt

windows to unix
  awk 'sub("$", "\r")' unixfile.txt > winfile.txt

Works in Netbsd, freebsd, Windows, DOS, ultrix, even vms, provided you got
awk.

--Debee





[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]
  Powered by Linux