cat test.sh
#!/bin/ksh
#set -x
for i in $(lspv |grep hdisk | awk '{print $1}')
do
for j in $(cat /tmp/input | grep hdisk | awk '{print $3}')
do
k=`lscfg -vl $i |grep $j`
print $i $k
done
done
The script outputs all of the available disks multiple times but not the disk number and its corresponding new_dev value from /tmp/input file that I'm trying to get.
Note: One thing I just noticed is that the 'new_dev' value in 3rd column from /tmp/input file has 5 digits whereas the lscfg output in the script for 'k' variable has only 4 digit i.e., there is no leading '0', is it possible to add a leading zero to the value that goes into 'k'
I can't see a relation between the outputs of the two commands given in post#3 connected by the /tmp/input contents.
Why don't you take a step back, and rephrase your request including ALL data available (and necessary to deal with it)?