Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbosgd!gatech!seismo!brl-tgr!gwyn From: gwyn@brl-tgr.ARPA (Doug Gwyn ) Newsgroups: net.unix Subject: Re: It is said that there is no such thing as a stupid question - let's see: Message-ID: <1997@brl-tgr.ARPA> Date: Sat, 25-Jan-86 23:53:51 EST Article-I.D.: brl-tgr.1997 Posted: Sat Jan 25 23:53:51 1986 Date-Received: Wed, 29-Jan-86 04:15:30 EST References: <508@ssc-vax.UUCP> Distribution: net Organization: Ballistic Research Lab Lines: 22 > 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).