Tuesday, January 28

 
Google Search: sed change cr/lf to

#!/usr/bin/tclsh # The above line is UNIX Scripting 'scenery' # 'newline' on output is cr/lf fconfigure stdout -translation crlf # 'newline' on input is cr/lf fconfigure stdin -translation crlf # While gets does not fail (gets will 'fail' on EOF) while {[gets stdin line] >= 0} { # If the line is not empty (not between a pair of newlines (cr/lf/cr/lf) if {[string length "$line"] > 0} { # Output the line, with a space instead of a newline. puts -nonewline "$line " # ^--- note the space } else { # otherwise, output cr/lf/cr/lf (end current line and add another) puts puts } }


|

<< Home

This page is powered by Blogger. Isn't yours?