diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/d2u.sh | 2 | ||||
-rw-r--r-- | bin/sd2u.awk | 6 | ||||
-rw-r--r-- | bin/su2d.awk | 6 | ||||
-rw-r--r-- | bin/u2d.sh | 3 |
4 files changed, 8 insertions, 9 deletions
@@ -16,7 +16,7 @@ for fn ; do # $r within it to get a literal carriage return; the escape characters # prescribed for ed(1) by POSIX are very limited ed -s -- "$fn" <<EOF || ex=1 -g/$r\$/ s/$r\$// +,s/$r\$// w EOF done diff --git a/bin/sd2u.awk b/bin/sd2u.awk index 02584952..b6e3da89 100644 --- a/bin/sd2u.awk +++ b/bin/sd2u.awk @@ -1,3 +1,3 @@ -# Convert DOS line endings to UNIX ones -{ sub(/\r$/, "") } -{ print } +# Convert stream DOS line endings to UNIX ones +BEGIN { RS = "\r\n" } +1 diff --git a/bin/su2d.awk b/bin/su2d.awk index 34a8c5ae..5a8eabaf 100644 --- a/bin/su2d.awk +++ b/bin/su2d.awk @@ -1,3 +1,3 @@ -# Convert UNIX line endings to DOS ones -!/\r$/ { $0 = $0 "\r" } -{ print } +# Convert stream UNIX line endings to DOS ones +BEGIN { ORS = "\r\n" } +1 @@ -16,8 +16,7 @@ for fn ; do # $r within it to get a literal carriage return; the escape characters # prescribed for ed(1) by POSIX are very limited ed -s -- "$fn" <<EOF || ex=1 -g/[^$r]\$/ s/\$/$r/ -g/^\$/ s/\$/$r/ +,s/\$/$r/ w EOF done |