delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/02/19/17:09:39

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
MIME-Version: 1.0
Message-Id: <3E540088.000005.01320@pexy>
Date: Thu, 20 Feb 2003 00:09:12 +0200
From: "Pieter Prinsloo" <pietp AT fedile DOT co DOT za>
X-FID: FLAVOR00-NONE-0000-0000-000000000000
X-FVER: 2.0
X-CNT: ;
X-Priority: 3
To: <cygwin AT cygwin DOT com>
Subject: problem report: gawk 3.1.1
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id h1JM9cN16673

Hi.

Have a query/problem with gawk version 3.1.1-5 dated 17/Oct/2002.
(allthough the problem as stated is for cygwin - it can also be emulated in
Linux
with gawk 3.1.0)

Given the following example
{
   one    two    printf("LEFT   printf("left}

If the input is a text file eg.
left side of record 1 @ right side of record
left side of record 2 @ right side of record
left side of record 3 @ right side of record

I get different results depending on
a. How the program is started
     i. Using gawk on the input file
    ii. Using gawk after a pipe on the input file.
b. The line termination of the program file and the input file.
      i. Both files Dos terminated "CRLF"
     ii. The program file Dos terminated and the other is Unix terminated 
LF"
    iii. The program file Unix terminated and the other is Dos terminated
    iv. Both files Unix terminated

a. Started as 
    "gawk -F@  -f short.awk short.txt" and BOTH files are DOS terminated. 
   the outputs..... 
LEFTleft
b. Started as
   "tail -5 short.txt|gawk -F@  -f short.awk" and BOTH files is DOS
terminated. 
   the outputs...
:EFT:eft
So - the carriage return is included as part of parameter two.

The results vary - depending on the format of the two files.

Question - is this a problem with pipes? or with gawk? Am my understanding
of Cygwin in a Dos environment correct?

My current work around is to include a line like the following in the code
{sub("^M","",$2)} 

Any comments or more info - please contact me.

bash, version 2.05b.0(8)
gawk version 3.1.1-5
tail (textutils) 2.0.21
on windoze 2000

Regards

Pieter Prinsloo.


Microsoft apparently thinks that R&D stands for 'Rewrap & Disguise'.

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019