From owner-freebsd-questions Thu Jul 4 13:39:20 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 445F537B400 for ; Thu, 4 Jul 2002 13:39:17 -0700 (PDT) Received: from njam.dhs.org (bkg8100by4lk.bc.hsia.telus.net [142.173.16.222]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6CCE843E09 for ; Thu, 4 Jul 2002 13:39:16 -0700 (PDT) (envelope-from viktorlazlo@telus.net) Received: from localhost (viktorlazlo@localhost) by njam.dhs.org (8.11.6/8.11.6) with ESMTP id g64KcnX26326; Thu, 4 Jul 2002 13:38:50 -0700 (PDT) (envelope-from viktorlazlo@telus.net) X-Authentication-Warning: njam.dhs.org: viktorlazlo owned process doing -bs Date: Thu, 4 Jul 2002 13:38:48 -0700 (PDT) From: Viktor Lazlo X-X-Sender: viktorlazlo@njam.dhs.org To: Odhiambo Washington Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Shell Script gurus?? In-Reply-To: <20020704172903.GF56027@ns2.wananchi.com> Message-ID: <20020704132754.E21920-100000@njam.dhs.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 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: 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