From owner-freebsd-questions@FreeBSD.ORG Wed Jun 2 08:24:06 2010 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBB5C106564A for ; Wed, 2 Jun 2010 08:24:06 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from ms16-1.1blu.de (ms16-1.1blu.de [89.202.0.34]) by mx1.freebsd.org (Postfix) with ESMTP id 888908FC21 for ; Wed, 2 Jun 2010 08:24:04 +0000 (UTC) Received: from [193.31.11.193] (helo=current.Sisis.de) by ms16-1.1blu.de with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1OJjF1-0005zO-5N; Wed, 02 Jun 2010 10:23:59 +0200 Received: from current.Sisis.de (current [127.0.0.1]) by current.Sisis.de (8.14.3/8.14.3) with ESMTP id o528O1An002921; Wed, 2 Jun 2010 10:24:01 +0200 (CEST) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by current.Sisis.de (8.14.3/8.14.3/Submit) id o528O1ZV002920; Wed, 2 Jun 2010 10:24:01 +0200 (CEST) (envelope-from guru@unixarea.de) X-Authentication-Warning: current.Sisis.de: guru set sender to guru@unixarea.de using -f Date: Wed, 2 Jun 2010 10:24:01 +0200 From: Matthias Apitz To: Aiza Message-ID: <20100602082401.GA2876@current.Sisis.de> References: <4C06131A.6010107@comclark.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4C06131A.6010107@comclark.com> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 8.0-CURRENT (i386) X-Con-Id: 51246 X-Originating-IP: 193.31.11.193 Cc: "questions@freebsd.org" Subject: Re: command to strip suffix in .sh script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Matthias Apitz List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 08:24:06 -0000 El día Wednesday, June 02, 2010 a las 04:15:22PM +0800, Aiza escribió: > I have this code > > archive_name=`echo -n "${fromarchive}" | tr -c '[:alnum:]' _` > > ` is the key under Esc key and ' key is next to enter key. > > fromarchive value is archivename-201006021514.34.tar.gz > > I want to strip the suffix -201006021514.34.tar.gz from the archivename. > > The archivename can be upper and lower case letters interspersed with _ > > > Do I have syntax problem with the code? I get no error on it. > > Do I have the tr command coded correctly? > > Or should I be using something else instead of tr command? $ echo 'archivename-201006021514.34.tar.gz' | sed 's/-.*$//' HIH matthias -- Matthias Apitz t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211 e - w http://www.unixarea.de/ Solidarity with the zionistic pirates of Israel? Not in my name! ¿Solidaridad con los piratas sionistas de Israel? ¡No en mi nombre!