🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

4 total messages Started by Henry Spencer Tue, 11 Dec 1984 22:45
awk vs. regular expressions starting with equal sign
#146
Author: Henry Spencer
Date: Tue, 11 Dec 1984 22:45
9 lines
1018 bytes
There is a fundamental lexical ambiguity in awk:  when you see "/=",
is this the divide-by-and-assign operator, or the start of a regular
expression which happens to begin with an equal sign?  Awk thinks it
is the operator, which means you can't start a regular expression with
an equal sign, ever.  To really write such a pattern, you have to resort
to schemes like "/.=/" or "/.*=/".  How annoying.  I can see no real fix.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry
Re: awk vs. regular expressions starting with equal sign
#148
Author: Charles LaBrec
Date: Thu, 13 Dec 1984 19:20
6 lines
797 bytes
Try /\=/.  It worked for me.

Charles LaBrec
UUCP:		pur-ee!Physics:crl, purdue!Physics:crl
INTERNET:	crl @ pur-phy.UUCP
Re: awk vs. regular expressions starting with equal sign
#150
Author: Jonathan Biggar
Date: Thu, 13 Dec 1984 20:21
12 lines
1322 bytes
In article <4770@utzoo.UUCP> henry@utzoo.UUCP (Henry Spencer) writes:
>There is a fundamental lexical ambiguity in awk:  when you see "/=",
>is this the divide-by-and-assign operator, or the start of a regular
>expression which happens to begin with an equal sign?  Awk thinks it
>is the operator, which means you can't start a regular expression with
>an equal sign, ever.  To really write such a pattern, you have to resort
>to schemes like "/.=/" or "/.*=/".  How annoying.  I can see no real fix.

You should use "/[=]/", it is better.

Jon Biggar
{allegra,burdvax,cbosgd,hplabs,ihnp4,sdccsu3}!sdcrdcf!jonab
Re: awk vs. regular expressions starting with equal sign
#151
Author: Robert Reed
Date: Fri, 14 Dec 1984 23:56
15 lines
1152 bytes
> There is a fundamental lexical ambiguity in awk:  when you see "/=",
> is this the divide-by-and-assign operator, or the start of a regular
> expression which happens to begin with an equal sign? 
>
> 				Henry Spencer @ U of Toronto Zoology
> 				{allegra,ihnp4,linus,decvax}!utzoo!henry

You can easily get around it by escaping it, such as

	awk '/\= / {...}' ...

I tried this on our 4.2BSD system and it seems to work just fine.

-- 
Robert Reed, Logic Design Systems Division, tektronix!teklds!bobr
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads