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