Hello Gurus,
I am facing one issue to get a portion of string from /etc/oraInst.loc
I ran the below command
cat /etc/oraInst.loc | grep VIS | cut -d "=" -f2
the result is as below :
/u01/oracle/VIS/oraInventory
But I want only upto /u01/oracle/VIS
.
How to achieve this.
Please advice.
Thanks-
P
Hi pokhraj_d,
Obviously
cat /etc/oraInst.loc | grep VIS | cut -d "=" -f2 | sed 's#/oraInventory##'
would work but if you need a more generic answer, you need to provide the content of /etc/oraInst.loc.
Regards
Santiago
RudiC
3
Try
awk -F= '/VIS/ {n=split ($2, T, "/"); sub ("/" T[n] "$", "", $2); print $2}' /etc/oraInst.loc
/u01/oracle/VIS
Try:
while IFS== read key val rest
do
case $val in
(*VIS*) echo "${val%/*}"
esac
done < /etc/oraInst.loc
sed
version:
sed -n 's#^.*=\(.*VIS\).*$#\1#p' /etc/oraInst.loc
Andrew
Hello Gurus,
Thank you very much... It worked..
Thanks-
P