Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <8C6D4989662C304087C58904BAB721A54B7368@Hermes.astrum.de> From: Harald Kierer To: cygwin AT cygwin DOT com Subject: awk strangely outputs to file Date: Mon, 3 Feb 2003 15:30:25 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Hi all, my awk (which is actually gawk) shows strange End-Of-Line-behaviour when redirecting the output to a file. Note: I use the old drive prefix "//" because of old scripts; works perfect currently. Example in bash: $ awk '{ print "123\n456" } ' /etc/passwd > "c:/x" (the /etc/passwd is just there to issue some loops) (every other target drive works the same as c) $ notepad "c:\x" ( => all in one line) $ awk '{ print "123\n456" } ' /etc/passwd > "//c/x" $ notepad "c:\x" (several lines with Windows CR/LF) The reason why I tested this is an awk script that writes some lines directly to a file and always ends up with a POSIX style output file. That worked different with our previous cygwin environment (very old). An example awk-file showing this: --- BEGIN { print "123" > v_OutFile; print "456" > v_OutFile; print "789" > v_OutFile; } --- Calling it with awk -v v_OutFile="c:/x" -f example.awk /etc/passwd and awk -v v_OutFile="//c/x" -f example.awk /etc/passwd results in a POSIX output file :( $ mount [snip] c: on //c type user (textmode,noumount) [snip] $ mount -p Prefix Type Flags // system textmode $ awk --version GNU Awk 3.1.1 [snip] $ uname -a CYGWIN_NT-5.0 RE0263 1.3.19s(0.71/3/2) 20030119 22:03:54 i686 unknown unknown Cygwin How can awk write Windows-like text files from within the script? The only way right now is to redirect the whole output like above. Bye, Harry -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/