Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!umd5!brl-adm!adm!drears@ardec.arpa From: drears@ardec.arpa (Dennis G. Rears (FSAC)) Newsgroups: comp.unix.questions Subject: Re: Picking a character from a word Message-ID: <13094@brl-adm.ARPA> Date: 23 Apr 88 17:26:54 GMT Sender: news@brl-adm.ARPA Lines: 24 Barsam Marasli writes: ->I have a csh question. ->I would like to have a script that will echo, say the 4th character ->of an arguement. I came up with the following: -> ->set word=`echo $1 | od -c` ; echo $word[5] -> ->which seems to do the job but somehow I feel like there are ->more elegant ways of doing this. Please reply by e-mail or ->post. Also what's an alternative in sh? Thanx. -> If all you want is the fourth character of a word echod out try: echo $1|cut -c4 This works in both the csh and the bourne shell. ...dennis -------------------------------------------------------------------------- ARPA: drears@ardec-ac4.arpa UUCP: ...!uunet!ardec-ac4.arpa!drears AT&T: 201-724-6639 Snailmail: Box 210, Wharton, NJ 07885 Flames: /dev/null Reincarnation: newton!babbage!patton!drears Work: SMCAR-FSS-E, Dennis Rears, Bldg 94, Picatinny Ars, NJ 07806 --------------------------------------------------------------------------