command to strip suffix in .sh script
Matthias Apitz
guru at unixarea.de
Wed Jun 2 08:24:06 UTC 2010
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 at 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!
More information about the freebsd-questions
mailing list