SUMMARY: a way to add the windows return character

From: Brehl, Blake (Blake.Brehl@anritsu.com)
Date: Fri Mar 14 2008 - 17:19:18 EST


Thank you for the several replies, I was successful using Edward's.
They are:

_____________________
>From Graham Allan
If I understand the question rightly, then yes, there are some tools
delivered with mtools which can do this (I think some version of mtools
comes with tru64). dos2unix and unix2dos might be what you need.

_____________________
>From Edward White
do you mean convert a unix text file to a dos/win text file?

 awk '{sub(/$/,"\r\n");print}' somefile > newfile

puts a crlf at the end of each line.

_____________________
>From Dr. Thomas P. Blinn
I would use "sed", the stream editor. Just replace the end of each line
with a return:

sed "s/$/\m/" $somefile > $newfilename

should work if I recall correctly, although I've have to double-check
the sed reference page to make sure that it will interpret the \m as
meaning to use a carriage return. And you could enter a carriage return
into the script as you type it with most editors using the control-v
control-m type of sequence, so if you need to you can put the carriage
return directly into the sed pattern literal. Alas, I don't have a
handy UNIX system on which to try this out or check the reference page.

______________________
>From Jay Leafey
There is an online utility you can use to convert UNIX-format, (i.e.
NL-terminated) files to DOS/Windows format (CR+LF) available at
http://www.iconv.com/unix2dos.htm.

There is also a Windows-based program to perform the same conversion,
available at http://www.iconv.com/unix2dos.htm.

In addition, there is a pair of programs available in several different
Linux distributions named dos2unix and unix2dos that are written in
reasonably-portable C that should be pretty easy to port to Tru64.

Hope that helps!

________________________
>From J.A. Guterrez
alias frommac="tr '\015' '\012'"
alias tomac="tr '\012' '\015'"
alias fromdos="tr -d '\015'"
alias todos='awk "{printf(\"%s\r\n\",\$0)}"'

________________________

It's a great list! Thanks for the assistance. Blake

-----Original Message-----
From: Brehl, Blake
Sent: Friday, March 14, 2008 11:44 AM
To: Tru64 Mailing List (tru64-unix-managers@ornl.gov)
Subject: a way to add the windows return character

Hello Admins,
 
it there a way to take a file and add the backspacing or windows return
characters, with UNIX commands. It'd be the opposite of using "col"
filtering
 
cat $somefile | col -b > $newfilename
 
which strips them out. We're mostly using ksh.

 
TIA, Blake
 
 
Tru64UNIX V5.1Asp1
GS80
 
Blake Brehl
Sys Admin/DBA
Anritsu Company United States
Morgan Hill, CA
blake.brehl@anritsu.com



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:50:37 EDT