I need to get the name of the file (esrt-deghasdf-keystore) before .jks.I want to do it using shellscript.Is it possible?
abcdefgh 7369 4825 0 00:12:26 pts/10 0:37 java -Djavax.net.ssl.keyStore=/abc3/esrt/der/fer-def2/esrt-deghasdf-keystore.jks
I need to get the name of the file (esrt-deghasdf-keystore) before .jks.I want to do it using shellscript.Is it possible?
abcdefgh 7369 4825 0 00:12:26 pts/10 0:37 java -Djavax.net.ssl.keyStore=/abc3/esrt/der/fer-def2/esrt-deghasdf-keystore.jks
It depends upon the format of the line. If you lines are all going to end in /path/to/file.ext
format, you can do:
echo $line | sed -e 's@.*/@@g' -e 's@\.[^.]*$@@g'
but really, it depends upon how exactly your lines are formatted and what you want out of it.
no need external tools. ksh can do the job
$ var="abcdefgh 7369 4825 0 00:12:26 pts/10 0:37 java -Djavax.net.ssl.keyStore=/abc3/esrt/der/fer-def2/esrt-deghasdf-keystore.jks"
$ echo ${var##*/}
esrt-deghasdf-keystore.jks
$ var=${var##*/}
$ echo ${var%.*}