- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Script question
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2002 05:55 AM - last edited on 06-24-2013 06:46 PM by Maiko-I
05-03-2002 05:55 AM - last edited on 06-24-2013 06:46 PM by Maiko-I
hi,
I have two files from which i would like to build a third file-
VGfile:(sample)
VG01 001 009 010 019
VG02 109 110 1A0 1B0
....
syminq.out: (sample)
****
/dev/rdsk/c49t0d0 M(8) EMC SYMMETRIX 5567 34001000 15697920
/dev/rdsk/c54t0d0 M(8) EMC SYMMETRIX 5567 34001000 15697920
/dev/rdsk/c49t0d1 M(8) EMC SYMMETRIX 5567 34009000 15697920
/dev/rdsk/c54t0d1 M(8) EMC SYMMETRIX 5567 34009000 15697920
.....
**
Using these two files, i would like to build a file , which will have the corresponding VG appended to every entry in syminq.out file as follows:
---
/dev/rdsk/c49t0d0 M(8) EMC SYMMETRIX 5567 34001000 15697920 VG01
/dev/rdsk/c54t0d0 M(8) EMC SYMMETRIX 5567 34001000 15697920 VG01
/dev/rdsk/c54t0d1 M(8) EMC SYMMETRIX 5567 34009000 15697920 VG01
/dev/rdsk/c49t0d1 M(8) EMC SYMMETRIX 5567 34009000 15697920 VG01
----
Any elegant way to do this?
thanks
P.S. This thread has been moved from HP-UX > System Administration to HP-UX > languages - HP Forum Moderator
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2002 06:05 AM
05-03-2002 06:05 AM
Re: Script question
34001000 == 001 009 010 019
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2002 06:13 AM
05-03-2002 06:13 AM
Re: Script question
1. Read syminq.out using while
2. Take out the first entry and replace rdsk with dsk.
3. Do a pvdisplay on that entry and grep for VG Name and use awk to filter out the vg.
4. Since you are still in the while loop append
vg to the line (or $0).
-Sri
PS: probably you forgot yourself that you developed a helpdesk system.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2002 06:16 AM
05-03-2002 06:16 AM
Re: Script question
i.e 34001 34009 etc.
In shell, grep seems the obvious way to go about it. But, once i get the grep results , how do i plug in the VG name for each entry in the last column?
Ok, over to perl procura ;-) This should be a breeze in perl.
cheers!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2002 06:21 AM
05-03-2002 06:21 AM
Re: Script question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2002 06:27 AM
05-03-2002 06:27 AM
Re: Script question
Here is the script for that
$ cat file1
vg01 001 009 010 019
vg02 011 019 011 011
$
$ cat file2
/dev/rdsk/c49t0d0 M(8) EMC SYMMETRIX 5567 34001000 15697920
/dev/rdsk/c54t0d0 M(8) EMC SYMMETRIX 5567 34001000 15697920
/dev/rdsk/c49t0d1 M(8) EMC SYMMETRIX 5567 34009000 15697920
/dev/rdsk/c54t0d1 M(8) EMC SYMMETRIX 5567 34009000 15697920
$
$ cat concat.sh
#!/usr/bin/ksh
{
set -x
count=0
while read j
do
count=`expr $count + 1`
done < file2
num=0
while [ ${num} -lt ${count} ]
do
num=`expr $num + 1`
str1=`sed -n "${num}p" file2`
str2=`sed -n "${num}p" file1 | awk '{print $1}'`
echo "${str1} ${str2}" >> file3
done
} 2>/tmp/concat.log
$
$ ./concat.sh
$ cat file3
/dev/rdsk/c49t0d0 M(8) EMC SYMMETRIX 5567 34001000 15697920 vg01
/dev/rdsk/c54t0d0 M(8) EMC SYMMETRIX 5567 34001000 15697920 vg02
/dev/rdsk/c49t0d1 M(8) EMC SYMMETRIX 5567 34009000 15697920
/dev/rdsk/c54t0d1 M(8) EMC SYMMETRIX 5567 34009000 15697920
Just my two cents.
-Sukant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2002 06:28 AM
05-03-2002 06:28 AM
Re: Script question
open(INP,"
chomp;
@ary=split(" ",$_);
$vg=shift(@ary);
foreach $ix (@ary) {
$map{$ix}=$vg;
}
}
close(INP);
open(INP,"
chomp;
($ix)=/ 34(\d\d\d)/;
print $_," ",$map{$ix},"\n";
}
-- Rod Hills
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2002 06:42 AM
05-03-2002 06:42 AM
Re: Script question
I did a little something for this exact same thing awhile back. Now I am not a programmer so my script is very 'juvenile'. I had 4 servers attached to 1 EMC Symmetrix - I used their inq utility and wrote my own scripts and had them rcp the result to 1 server where I combined all the files and produced a flat file sorted that I then imported into Excel and dressed up. I am not proficient enough to write the print code to get a good report via HPUX. Also 1 of the servers-I had to adjust my script since it used mass amounts of 'raw' (yes I said raw) volumes...and the inq utility will not show these as used (arghghg!).
Anyway...I wrote these little ditties and I'll be happy to email them to you if you want to take a look.
Mine puts it down to the filesystem (except for the raw devices, I could only get to the vg).
rworkman@wvbep.org
Rgrds,
Rita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2002 06:45 AM
05-03-2002 06:45 AM
Re: Script question
The luns in question are not yet assigned to a VG. I want to create a map to make the vg creation process easy. Yeah, i am brain-dead today ;-) BTW,Good to see you back.
Anyway, i came up with a two-script kludge which does what i am looking for:
---
while read -r vg d1 d2 d3 d4
do
grep -e 34$d1 -e 34$d2 -e 34$d3 -e 34$d4 syminq.out >>$vg.map
done
for i in `ls *.map`
do
while read -r d1 d2 d3 d4 d5 d6 d7
do
i1=`echo $i |awk '{FS="."; print $1}'`
echo "$d1 $d2 $d3 $d4 $d5 $d6 $d7 $i1" >>$i.new
done <$i
done
---
This creates a file vgname.map.new for each VG which has the corresponding Lun entries of the inq file appended to the vg name.
Sort of messy, but it deserves some points ;-)
Procura - i hope this explains on what i am looking for.
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2002 06:52 AM
05-03-2002 06:52 AM
Solution@ARGV = ("vgfile");
while (<>) {
chomp;
($vg, @ary) = split " ";
@map{@ary} = ($vg) x @ary;
}
@ARGV = ("syminq.out");
while (<>) {
s/( 34(\d\d\d).*)/$1 $map{$2}/;
print;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2002 06:54 AM
05-03-2002 06:54 AM
Re: Script question
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2002 06:55 AM
05-03-2002 06:55 AM
Re: Script question
Got it..
Look at this
vgfile is your VGfile
inq.out is your syminq.out
Look at out file after running this script.
---start of the script
while read LINE
do
#you may need to modify the following if your sample changes
INQ=`echo $LINE |awk '{print $6}'|cut -b 3-5`
while read vgline
do
echo $vgline |grep $INQ > /dev/null 2>&1
if [ $? = 0 ]
then
VG=`echo $vgline|awk '{print $1}'`
echo $LINE $VG >> out
fi
done < vgfile
done < inq.out
---end of the script----
See if it works...
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2002 07:35 AM
05-03-2002 07:35 AM
Re: Script question
My 2 cents
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 04:27 AM
05-06-2002 04:27 AM
Re: Script question
(procura: i made one change replacing the \d\d\d with \w\w\w , since the search is from 0-F and not just decimals).
I will assign points later during the day;
cheers
-raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 04:53 AM
05-06-2002 04:53 AM
Re: Script question
Try these.... Two shs.
1- first file.sh : run on each box connected to symmetrix
2- put all files.dat in a box.
3- Edit file2.sh and change box1 by hostname. etc.
change email address
4- Run file2.sh
SEE SOURCE FIRST.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 04:54 AM
05-06-2002 04:54 AM
Re: Script question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 07:03 AM
05-06-2002 07:03 AM
Re: Script question
It seems that you're already satisfied with some answers. I did not see your comment and no assigned points while i was working out an effective script.
Although my solution is a bit late, i post my solution, because it is really simple:
while read x
do
vg=`echo $x |cut -f1 -d' '`
for i in $x
do
awk -v vg=$vg /$i/'{print $0" "vg}' file2
done
done < file1
..where file1 is the vg-file and file2 the device-file. It simply search xxx in the big file, and prints with vg-name.
Maybe not the price for beautiness, but effective it s.
Regards,
Ceesjan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 01:52 PM
05-06-2002 01:52 PM
Re: Script question
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2006 04:32 AM
03-30-2006 04:32 AM
Re: Script question
Thanks for the valuable information.
I have a situation.
we have emc symmetrix,
all my servers are looking at all the disks and devices.
If we expand a file system on Server A, we are in a situation of over-writing file system on server B or C or D .
I am figuring it out on how to use disks that are not used on any server while expanding the existing file systems or creating new file systems.
Can any one give me some comments.
my email id is chandra.sekhar@ipaper.com