delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1996/10/25/21:54:19

From: reed AT engr DOT orst DOT edu (Brandon Reed)
Subject: awk acting funny
25 Oct 1996 21:54:19 -0700 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <327182C0.1D0D.cygnus.gnu-win32@engr.orst.edu>
Mime-Version: 1.0
X-Mailer: Mozilla 3.0Gold (Win95; I)
Original-To: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

I looked through the documentation and FAQ but couldn't find
a reason for the behavior of awk (gawk) ie:

D:\bin> dir | gawk '{print "Hello " $1 }'
GAWK.EXE: cmd. line:1: '{print
GAWK.EXE: cmd. line:1: ^ Invalid char ''' in expression

The same command produces normal output on a unix machine, no errors.

I figured out that I can do:
dir |gawk "{print $1}" 
but it's impossible to put anything other than the $1 etc. in the
expression because I can't put quotes inside quotes.

ie dir |gawk "{print $3 " " $1}"
produced errors. 

 I guess I'm really curious as to why it was necessary to stray from the
normal usage of single quotes around the program (as shown in the gnu
documentation) to use double quotes.
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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