I'd like to extract the name out of a file name, which is actually a Slackware package file..
For example:
$ cd /var/log/packages
$ ls openss*
openssh-3.7.1p2-i486-1
openssl-0.9.7a-i386-2
openssl-solibs-0.9.7a-i386-2
Extracting 'openssh' from the first package is easy:
ls openssh-3.7.1p2-i486-1 | cut -d'-' -f1
would do it.. but that just doesn't cut it for the last package, which has a dash in it's name..
Performing the same command on the 'openssl-solibs' would cause the '-solibs' part to be dropped.. which I don't want..
Anyone got any idea on how to do this?