Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!csli!gandalf From: gandalf@csli.STANFORD.EDU (Juergen Wagner) Newsgroups: comp.unix.questions Subject: Re: Picking a character from a word Message-ID: <3601@csli.STANFORD.EDU> Date: 23 Apr 88 02:47:36 GMT References: <578@amethyst.ma.arizona.edu> Reply-To: gandalf@stanford (Juergen Wagner) Organization: Center for the Study of Language and Information, Stanford U. Lines: 14 How about sed 's/^...\(.\).*/\1/' which extracts the fourth character of a string read from stdin. More general (and more ugly): awk '{print substr($0,4,1);}' which allows you to pick an arbitrary substring from the lines on stdin. If you are using this very often, I suggest to write a small C program doing the job (string manipulation). Awk and sed are not very fast. -- Juergen "Gandalf" Wagner, gandalf@csli.stanford.edu Center for the Study of Language and Information (CSLI), Stanford CA