9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] regexp metacharacter difficulty inside grap
@ 2010-08-10  5:23 Jeff Sickel
  2010-08-10  8:37 ` Steve Simon
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Jeff Sickel @ 2010-08-10  5:23 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I've been trying to figure out this little one for a while now and figure I could use a refresher course in regexp.

There are quite a few files that I'm trying to copy through grap that would be really easy if I could take a line like:

	# (Yo 4.9534)

and turn it into a value for x,y graphing.  Unfortunately, I'm completely blanking out on how to get that pesky ')' stripped out.  I try the following:

	if "$2" == "(Yo" then {
	 	print sprintf("Yo was %f", yo)
		 yo = sh { echo $3 | sed 's/\)#//' }
		 print sprintf("Yo is %f", yo)
	} 

but that just gives me:

	cpu% eval `{doctype t.g} | lp -dstdout > t.ps
		Yo was 8.579000
	rc: line 2: token ')': syntax error
	grap: syntax error???: No such file or directory
	 near 20100809_pscheck_XX.d:8
	 context is
		yo = sh { echo 4.9534)# | sed 's/\)#//' } >>> <<<


I'm not quite sure why grap converts $3 into "4.9534)#", so I try brute force:

	cpu% echo '4.9534)#' | sed 's/\)#//' 
	4.9534


Does anyone have any hints on what might I be doing wrong in my grap source?

-jas




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

end of thread, other threads:[~2010-08-21  2:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-10  5:23 [9fans] regexp metacharacter difficulty inside grap Jeff Sickel
2010-08-10  8:37 ` Steve Simon
2010-08-10  8:54 ` Rudolf Sykora
2010-08-10  9:14 ` Rudolf Sykora
2010-08-10 11:45 ` erik quanstrom
2010-08-10 13:06   ` Jeff Sickel
2010-08-10 13:10 ` Federico G. Benavento
2010-08-10 13:41   ` Rudolf Sykora
2010-08-10 13:58     ` Jeff Sickel
2010-08-10 14:11       ` erik quanstrom
2010-08-10 15:52         ` Russ Cox
2010-08-11  5:41           ` Jeff Sickel
2010-08-17  6:07           ` [9fans] iwp9 macros.ms + mkfile, (was--Re: regexp metacharacter difficulty inside grap) Jeff Sickel
2010-08-17 16:21             ` Russ Cox
2010-08-18  1:28               ` Jeff Sickel
2010-08-18  1:59                 ` Russ Cox
2010-08-20 14:58                   ` Jeff Sickel
2010-08-21  2:22                     ` Russ Cox

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).