dos to unix CR/LF conversion?

James Knott james.knott-bJEeYj9oJeDQT0dZR+AlfA at public.gmane.org
Mon Nov 10 01:28:19 UTC 2003


Peter L. Peres wrote:
> #!/bin/bash /usr/local/bin/u2d 755
> awk '/\r$/ {printf("%s\n",$0);next;} {printf("%s\r\n",$0);next;}'
> 
> #!/bin/bash /usr/local/bin/d2u 755
> tr -d '\r\032'
> 
> Use as filters, as in:
> 
> <myfile d2u >myfile.changed
> 
> do *not* use the same file for input and output. The input file will be
> deleted if you do this.

Several years ago, I used to work on a system based on a Data General 
Nova 800.  In the monitor program, the command to copy a file was:

$XFER source_file>dest_file

The command to delete a file was:

$XFER source_file>

This meant that accidently hitting the Enter key too soon, would result 
in deleting a file you intended to copy!


--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list