1847584 Members
2858 Online
110265 Solutions
New Discussion

Re: newfs

 
SOLVED
Go to solution
Donald C Nelson
Frequent Advisor

newfs

Does anyone know how I would take a file like
/dev/vg02/data
/dev/vg02/data2
/dev/vg02/data3
/dev/ora/lvol1

and extract it so I could replace the logical volume with the r before the logical volume so I could use this for an input to a newfs command no matter what the volume group name is.
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: newfs

Something like this should work:

INFILE=/xxx/yyy/myfile # your above file

cat ${INFILE} | while read X
do
DIR=$(dirname ${X})
LVOL=$(basename ${X})
RLVOL="${DIR}/r${LVOL}"
echo "Full raw volume = ${RLVOL}"
done

man dirname, basename for details.
If it ain't broke, I can fix that.
Donald C Nelson
Frequent Advisor

Re: newfs

Thanks Clay, that was it.
D Block 2
Respected Contributor

Re: newfs

dude, give Clay the points assignment..
Golf is a Good Walk Spoiled, Mark Twain.
B. Hulst
Trusted Contributor

Re: newfs

Hi,

Is there a hidden next level for Olympians...? :)

Regards,
Bob
Ranjith_5
Honored Contributor

Re: newfs

Hi Donald,

Something like the following will be more simpler. I have tested the output of the following and its working.

#!/usr/bin/sh

vgdisplay -v /dev/vg00|grep -i "lv name" | awk '{print $3}'|cut -f 4 -d "/">test

sed 's/^/r/g' test>rlvols

#here comes your code for newfs
<
code
>

rm test
rm rlvols

#End


Regards,
Syam