I cannot work this out, seems my command in awk is not good enough:
Basically I'd like to extract information from a simple Linux ls -l:
ls -l /etc/alternatives/java
lrwxrwxrwx. 1 root root 29 Apr 5 12:28 /etc/alternatives/java -> /jre/IBM/JDK6SR10FP1/bin/java
I then use awk to retrieve this part:
ls /etc/alternatives/java -l | awk -F"->" '{print $2}'
/jre/IBM/JDK6SR10FP1/bin/java
As I need to remove the trailing /bin/java to make it a valid $JAVA_HOME, how to do that in bash?
All I want is:
/jre/IBM/JDK6SR10FP1
Many thanks in advance