9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] "Intervalic
@ 2006-02-22 18:33 yard-ape
  2006-02-22 18:51 ` Russ Cox
  2006-02-22 19:50 ` Bakul Shah
  0 siblings, 2 replies; 11+ messages in thread
From: yard-ape @ 2006-02-22 18:33 UTC (permalink / raw)
  To: 9fans, REs,
	/tm\x04� \b��
	\b\x01@,
	Explicit, or

[-- Attachment #1: p9res --]
[-- Type: text/plain, Size: 1378 bytes --]

I'm using awk on Plan9 to restructure a 70,000 cel table containing no proper delimiters---it's just visually-formatted with spaces.  (Records split over multiple lines, erratically justified columns, etc. etc.  A good time.)

For such a case in unix, I'd make heavy use of what I've seen referred to as "intervalic" regular expressions (numeric ranges expressed in braces: "\{n,n\}" in simple and basic unix regular expressions, "{n,n}" in extended posix regular expressions).  But regexp(6) doesn't mention these, and I get errors from sam, awk, ed, et. al. when I try them.

Am I misunderstanding the REP operators?  If not, how do you folks like to handle such problems as one might use intervalic expressions on?  Do you just use an explicit regular expression?  If so, I'm curious about the reasoning behind the design decision to leave intervalic expressions out.  

Contrived Example.  To match the character before the second occurance of "Unit" in the line:

Item Number     Unit    Unit/Lot  Date               Unit       Operating

Simple and Basic REs:
.\{24\}

Extended:
.{24}

Plan9:
'Item Number     Unit    '
(or):
'Item Number     Unit  +'
(or the more general):
........................


Anbd that last expression I suppose I would create with something like 

seq 24 | sed 's/.*/./g' | tr -d '\
'

Thanks in advance,

-Derek

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2006-02-23  2:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-22 18:33 [9fans] "Intervalic yard-ape
2006-02-22 18:51 ` Russ Cox
2006-02-22 19:20   ` yard-ape
2006-02-23  2:24     ` geoff
2006-02-22 19:50 ` Bakul Shah
2006-02-22 20:58   ` yard-ape
2006-02-22 21:47     ` Russ Cox
2006-02-22 23:36       ` yard-ape
2006-02-22 18:50         ` Russ Cox
2006-02-23  0:05           ` yard-ape
2006-02-22 23:42         ` andrey mirtchovski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).