xref: /illumos-gate/usr/src/test/util-tests/tests/awk/gnu/regeq.awk (revision 3ee4fc2aa6b5136515cc3eed32d3c6ef33e37471)
1*3ee4fc2aSCody Peter Mello#Date: Sat, 8 May 1999 17:42:20 +0200
2*3ee4fc2aSCody Peter Mello#From: Iva Cabric <ivac@fly.srk.fer.hr>
3*3ee4fc2aSCody Peter Mello#To: bug-gnu-utils@gnu.org
4*3ee4fc2aSCody Peter Mello#Cc: arnold@gnu.org
5*3ee4fc2aSCody Peter Mello#Subject: Problem in gawk with match
6*3ee4fc2aSCody Peter Mello#
7*3ee4fc2aSCody Peter Mello#Hello,
8*3ee4fc2aSCody Peter Mello#
9*3ee4fc2aSCody Peter Mello#gawk reports fatal error in match when first character in regexp is "=" :
10*3ee4fc2aSCody Peter Mello#
11*3ee4fc2aSCody Peter Mello#$ gawk '{ where = match($0, /=a/); print where}'
12*3ee4fc2aSCody Peter Mello#gawk: cmd. line:1: { where = match($0, /=a/); print where}
13*3ee4fc2aSCody Peter Mello#gawk: cmd. line:1:                     ^ parse error
14*3ee4fc2aSCody Peter Mello#gawk: cmd. line:1: fatal: match() cannot have 0 arguments
15*3ee4fc2aSCody Peter Mello#
16*3ee4fc2aSCody Peter Mello#Using "\=" instead "=" works without problems :
17*3ee4fc2aSCody Peter Mello#
18*3ee4fc2aSCody Peter Mello#$ gawk '{ where = match($0, /\=a/); print where}'
19*3ee4fc2aSCody Peter Mello#sdgfa
20*3ee4fc2aSCody Peter Mello#0
21*3ee4fc2aSCody Peter Mello#asdfds=a
22*3ee4fc2aSCody Peter Mello#7
23*3ee4fc2aSCody Peter Mello#
24*3ee4fc2aSCody Peter Mello#Other versions of awk have no problems with "/=/" (except oawk on SunOS).
25*3ee4fc2aSCody Peter Mello#
26*3ee4fc2aSCody Peter Mello#--
27*3ee4fc2aSCody Peter Mello#     	 		 	 @
28*3ee4fc2aSCody Peter Mello#
29*3ee4fc2aSCody Peter Mello{ where = match($0, /=a/); print where}
30