Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read argu from 1 file pass to other file

Status
Not open for further replies.

visvid

Technical User
Jun 3, 2002
131
GB
Question:

How do i pass arguments from one file to another and then execute a cmd ?

Scenario

2 files , file one is called solarisdisks and the other is called veritaslist

solarisdisk is :

c3t30d11
c3t30d12
c3t30d13
c3t30d14
c3t61d11
c3t61d12
c3t61d13
c3t61d14

veritaslist

hd3_3_11
hd3_3_12
hd3_3_13
hd3_3_14
hd3_61_11
hd3_61_12
hd3_61_13
hd3_61_14


what I want to do is once I have vxdg init <dgname> diskname=c?t?d?

I want to run is a command that will basically do

vxdg -g <dgname> adddisk <veritaslist>= <solarisdisk>

Cheers

visvid
 
Try something like this:
Code:
pr -m -t veritaslist solarislist | awk '
{printf &quot;vxdg -g <dgname> adddisk %s=%s\n&quot;,$1,$2}
' >/path/to/newcommand.sh

Hope This Help
PH.
 
Try something like this:
Code:
pr -m -t veritaslist solarislist | awk '
{printf &quot;vxdg -g <dgname> adddisk %s=%s\n&quot;,$1,$2}
' >/path/to/newcommand.sh
Or for immediate execution:
Code:
pr -m -t veritaslist solarislist | while read v s; do
  vxdg -g <dgname> adddisk $v=$s
done

Hope This Help
PH.
 
PHV,

you could've done it like this without the intermediate file:

Try something like this:
pr -m -t veritaslist solarislist | awk '
{printf &quot;vxdg -g <dgname> adddisk %s=%s\n&quot;,$1,$2}
' | sh

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
vxdg init stdg01 hd3_3_11=c3t30d11
paste -d&quot;|&quot; vertiasdisks sundisks | while IFS=&quot;|&quot; read var1 var2
do
vxdg -g stdg01 adddisk $var1=$var2
done


Is the best way i found to do this, cheers for the input anyway
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top