delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
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 <Harald DOT Kierer AT astrum DOT de> |
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 |
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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |