aims@ssc-vax.UUCP (John Daley) (01/23/86)
*** OK, I REPLACED IT - NOW WHAT? ***
 
I'm submitting this question to you  (wizards)  because I don't know the answer.
Is there a way to dimension buffers (arrays) in scripts,  and selectivly extract
portions/fields of data from them?  I would like to also be able to do this with
buffers in the B and C shells.
Example:
  LONG_THANKS="Thanksinadvanceforallyourhelp"
 
I want to take columns 1-5, add a space, and add columns 22-24. and set them into
the buffer SHORT_THANKS.
Example:
  SHORT_THANKS="Thank you"
 
 
-- 
################################################################################
#  Ray E. Saddler III @ Boeing Aerospace Company - Ballistic Systems Division  #
#  Tech. Applications  CAD Support and Administration - BAC Scientfic Systems  #
#  Seattle, Washington (vacation spot of the stars) USA, Earth, lost in space  #
################################################################################
Disclaimer: The  Boeing  Company shall not be held responsible for damage caused
            by fire, in the event I should spontaneously (sp?) combust.  G'-day.
Quote: "" - unknowngwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (01/26/86)
> Is there a way to dimension buffers (arrays) in scripts, and selectivly extract > portions/fields of data from them? I would like to also be able to do this with > buffers in the B and C shells. > > Example: > > LONG_THANKS="Thanksinadvanceforallyourhelp" > > I want to take columns 1-5, add a space, and add columns 22-24. and set them into > the buffer SHORT_THANKS. You can't readily do this without the aid of string-handling utilities; I seem to recall some substring utilities posted to the net within the past year. (The Korn shell has some additional facilities built in that would help.) The System V utility "cut" can be used to extract fields from strings, e.g. SHORT_THANKS=`echo "$LONG_THANKS" | cut -c1-5`\ `echo "$LONG_THANKS" | cut -c22-24` This isn't ideal, but it may serve your needs (strange as they are).