[Oberon] Text2ASCII at github - was: "all in one git tree"

Tomas Kral thomas.kral at email.cz
Tue Dec 29 15:02:02 CET 2020


Just posting a small shell script, in case you might find usefull, I do
use all the time.

Save it as e.g. conv, and chmod a+x on it

# NOTE Oberon expects only CR line termination,
# but CRLF make files readable on most platforms
# (c)2017 tcat <thomas.kral at email.cz>

USAGE="USAGE: ./conv [ux2ob|ob2ux|dos2ux|dos2ob] [file] > [output]"

case $1 in

# LF to CR line ending
  ux2ob) sed ':a;N;$!ba;s/\n/\r/g' $2 ;;

# CR to LF line ending
  ob2ux) sed s/\\r/\\n/g $2 ;;

# CRLF to LF line ending
  dos2ux) sed s/\\r//g $2 ;;

# CRLF to CR line ending
  dos2ob) sed ':a;N;$!ba;s/\n//g' $2 ;;
  *) echo $USAGE; exit 1 ;;

Tomas Kral <thomas.kral at email.cz>

More information about the Oberon mailing list