🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #18155

Re: MPW Shell question

#18155
From: David W. Berry
Date: Sat, 15 Aug 1987 23:07
43 lines
2368 bytes
In article <4021@oberon.USC.EDU> barad@othello.usc.edu () writes:
>In MPW Shell, I am trying to select the first line in a file
>(including the cr) and remove that line and all copies of that line.
>The way I tried in MPW shell is the following:
>
>Find /(?=dn)@1/
>Replace -c inf /{@1}/ ''
>
>The "d" is really the delta, and the "=" is the curvy equal sign, and
>the "inf" is the infinity sign.
>
>I would think that the 1st line would find (and select) the first line
>from the cursor point (that contains at least 1 char) and the cr.  It
>should assign this to the shell variable @1.  Then, I will replace all
Here's the heart of the misunderstanding.  The first line won't get
stuck into a shell variable at all, but will rather be stored away 
somewhere in the actual command executing and not be carried forward
to the replace.
>occurances of the value of @1 with nothing.  This doesn't work.  I do
>know that:

I would try something like:
	Cut 1					# Cut out line one
	Open -t -n Tmp.File			# Kludge to paste into command
	Paste *:inf				# replace contents with line
	Target OriginalFile			# go back to real file
	Find *					# start at line one
	Replace -c inf del/*`cat Tmp.File`inf/:!1 ''	# get rid of lines
	Delete Tmp.File

Where funny characters are:
	*		Bullet = option-8
	inf		Infinity = option-5
	del		Delta = option-j

Note that the Replace command finds an affected line and extends
the selection to exist from the start of the current selection
to one character beyond it.  That makes up for the fact that the
cat on the command line will get the newline stripped out.
-- 
	David W. Berry
	dwb@well.uucp                   dwb@Delphi
	dwb@apple.com                   293-0752@408.MaBell
Technical Details
Message-ID: <1482@apple.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!rutgers!ucla-cs!zen!ucbvax!hplabs!pyramid!voder!apple!dwb
References: <4021@oberon.USC.EDU>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!rutgers!ucla-cs!zen!ucbvax!hplabs!pyramid!voder!apple!dwb
From: dwb@apple.UUCP (David W. Berry)
Newsgroups: comp.sys.mac
Subject: Re: MPW Shell question
Message-ID: <1482@apple.UUCP>
Date: Sat, 15-Aug-87 19:07:08 EDT
Article-I.D.: apple.1482
Posted: Sat Aug 15 19:07:08 1987
Date-Received: Sun, 16-Aug-87 13:07:19 EDT
References: <4021@oberon.USC.EDU>
Reply-To: dwb@apple.UUCP (David W. Berry)
Distribution: world
Organization: Apple Computer Inc., Cupertino, USA
Lines: 43
Keywords: MPW Shell, regular expressions