From owner-freebsd-questions Fri Jul 5 7:35:31 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B4D0537B401 for ; Fri, 5 Jul 2002 07:35:28 -0700 (PDT) Received: from mailhost.hirshfields.com (mailhost.hirshfields.com [63.226.159.37]) by mx1.FreeBSD.org (Postfix) with ESMTP id A88C443E3B for ; Fri, 5 Jul 2002 07:35:27 -0700 (PDT) (envelope-from pbiessener@hirshfields.com) Received: from ultra.hirshfields.com (ultra.hirshfields.com [192.168.195.101]) by mailhost.hirshfields.com (8.11.4/8.11.4) with SMTP id g65EZQe45872 for ; Fri, 5 Jul 2002 09:35:26 -0500 (CDT) Received: (qmail 7824 invoked from network); 5 Jul 2002 14:35:19 -0000 Received: from spicer.hirshfields.com (HELO hirshfields.com) (192.168.195.244) by ultra.hirshfields.com with SMTP; 5 Jul 2002 14:35:19 -0000 Message-ID: <3D25AEAD.2040103@hirshfields.com> Date: Fri, 05 Jul 2002 09:35:25 -0500 From: C Peter Biessener User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0rc2) Gecko/20020512 Netscape/7.0b1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: FreeBSD Questions Subject: Re: Shell Script gurus?? References: <20020704140403.L333-100000@atlas.home> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG The pattern matching which Mikko suggested will work, but is not guaranteed to be available in all shells. Two other methods are: host=`echo $domain_name | cut -f1 -d` -OR- host=`echo $domain_name | awk -F"." '{print $1}'` M.T. wrote: > On Thu, 4 Jul 2002, Viktor Lazlo wrote: > > >> >>On Thu, 4 Jul 2002, Odhiambo Washington wrote: >> >> >>>Now in my script I am reading the domain name from stdin (?? >>> >>> echo Entering domain name in MySQL DB: >>> echo "" >>> domain_name= >>> echo -n Please supply the domain name to activate: >>> read domain_name >>> >>> >>>The domain name can be domain.com or the domain.co.ke but I am interested >>>in the part before the first (.) so that I can manipulate some parameter >>>with it. >>> >>>How do I get that alone in a shell after I've read the domain name into >>>a variable?? >> >>I'm sure there's much slicker ways of going about doing it but this works >>for me: > > > You mean something like: > > domain_name="${domain_name%%.*}" > > :-) > /Mikko > > >>read var1 >>var2=`echo $var1 | sed -n 's/\.com//p'` >> >>Regards, >> >>Viktor >> >> >>To Unsubscribe: send mail to majordomo@FreeBSD.org >>with "unsubscribe freebsd-questions" in the body of the message >> > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message