Trying out Slackware

Deborah Norling debee at jfcl.com
Mon Jun 25 23:45:26 EDT 2007


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





More information about the Speakup mailing list