Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Jun 2010 10:24:01 +0200
From:      Matthias Apitz <guru@unixarea.de>
To:        Aiza <aiza21@comclark.com>
Cc:        "questions@freebsd.org" <questions@freebsd.org>
Subject:   Re: command to strip suffix in .sh script
Message-ID:  <20100602082401.GA2876@current.Sisis.de>
In-Reply-To: <4C06131A.6010107@comclark.com>
References:  <4C06131A.6010107@comclark.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <guru@unixarea.de> - 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!



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100602082401.GA2876>