🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bit.listserv.xedit-l
Article #802

Re: Looking for a macro

#802
From: Peter Ferrara
Date: Thu, 30 Apr 1992 14:08
59 lines
1784 bytes
>Date:         Wed, 29 Apr 1992 14:27:34 EDT
>Reply-To:     VM System Editor List <XEDIT-L@uga.cc.uga.edu>
>From:         laszlo grunfeld <LAZBM%CUNYVM.BITNET@uga.cc.uga.edu>
>
>I have a file with names like this
>
>JOHN DOE
>JANE DOE
>...
>I'd like to convert them to look like this
>John Doe
>Jane Doe
>...
>Does anyone have a macro to do this?
>
>Thanks
>
>Laszlo Grunfeld


The following macro will convert all the lines in a file and will leave all
column alignments unchanged.


/* FIXNAMES XEDIT MACRO */

lcase = 'abcdefghijklmnopqrstuvwxyz'
ucase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

'COMMAND :1'

do forever
   'COMMAND EXTRACT /CURLINE/'
   cl = curline.3
   nl = ''
   $ = 1
   ld = 1
   do forever
      wi = wordindex(cl,$)
      if wi=0 then leave
      if wi^=ld then do
         blanks = copies(' ',wi-ld)
         nl = nl || blanks
         end
      w = word(cl,$)
      wl = length(w)
      w = translate(w,lcase,ucase)
      w = translate(left(w,1)) || substr(w,2)
      nl = nl || w
      ld = wi + wl
      $ = $ + 1
      end
   'COMMAND CLOCATE :1'
   'COMMAND CREPLACE' nl
   'COMMAND NEXT'
   if rc^=0 then leave
   end

exit
Technical Details
Message-ID: <XEDIT-L%92043010125907@UGA.CC.UGA.EDU>
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!auvm!URIACC.BITNET!FERRARA

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10c92b,3a5f31e27656aeae
X-Google-Attributes: gid10c92b,public
X-Google-ArrivalTime: 1992-04-30 07:08:42 PST
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!auvm!URIACC.BITNET!FERRARA
Message-ID: <XEDIT-L%92043010125907@UGA.CC.UGA.EDU>
Newsgroups: bit.listserv.xedit-l
Date:         Thu, 30 Apr 1992 10:08:42 EDT
Sender:       VM System Editor List <XEDIT-L@UGA.BITNET>
From:         Peter Ferrara <FERRARA@URIACC.BITNET>
Subject:      Re: Looking for a macro
Lines: 59