Need help with filtering


 
Thread Tools Search this Thread
Operating Systems AIX Need help with filtering
# 1  
Old 06-01-2012
[SOLVED] Need help with filtering

Hi!!

I have a bit of a task here and filtering/scripting not my strongest. I have to collect info of approx 1100 hdiskpower.so i have appended all the hdisk into a text file and i need it to run the command lscfg -vl to confirm if the drive is symmetrix. here's what i have so far

Code:
at hdiskpower | xargs -i lscfg -vl {} |grep SYMMETRIX

Now this works fine but I can't seem to figure out how to get the hdiskpower line in this list as well.

Now if you can also help me with one more thing I would greatly appreciate it!
once i collect up all the info of the drives that are symmetrix i need to calculate all the disk space that these drives have (total space) I believe that I am going to use the command <getconf DISK_SIZE /dev/hdiskpower$>

Like I'm saying I need help!

Thanks in advance!


Moderator's Comments:
Mod Comment edit by bakunin: please use [CODE] .. [/CODE]-tags when posting code or terminal output. Thank you.

Last edited by bakunin; 06-02-2012 at 02:36 AM..
# 2  
Old 06-01-2012
in need of your help

Hi!!

I have a bit of a task here and filtering/scripting not my strongest. I have to collect info of approx 1100 hdiskpower.so i have appended all the hdisk into a text file and i need it to run the command lscfg -vl to confirm if the drive is symmetrix. here's what i have so far

at hdiskpower | xargs -i lscfg -vl {} |grep SYMMETRIX

Now this works fine but I can't seem to figure out how to get the hdiskpower line in this list as well.

Now if you can also help me with one more thing I would greatly appreciate it!
once i collect up all the info of the drives that are symmetrix i need to calculate all the disk space that these drives have (total space) I believe that I am going to use the command <getconf DISK_SIZE /dev/hdiskpower$>

Like I'm saying I need help!

Thanks in advance!


Moderator's Comments:
Mod Comment edit by bakunin: you should not open the same question in several boards. What's more it should have gone the "shell programming and scripting", not "programming", which is for High-Level Languages.

I have merged the threads now, but, PLEASE, don't make me do so any more. Thank you.

Last edited by bakunin; 06-02-2012 at 03:22 AM..
# 3  
Old 06-02-2012
Quote:
Originally Posted by vpundit
I have to collect info of approx 1100 hdiskpower.so i have appended all the hdisk into a text file and i need it to run the command lscfg -vl to confirm if the drive is symmetrix.
It would help a bit to know what that file looks like. If you want a precise answer you might consider asking precise questions and state your preconditions precisely.

Maybe something like the following is what you look for. It will most probably need some refining, but should work as a basis on which to build your own:
Code:
typeset    hdpwr=""
typeset -i hdsize=0
typeset -i hdsum=0

exec 3>/path/to/resultfile

print -u3 "---- SYMMETRIX disks / sizes at $(date)"
cat file-with-hdisks | while read hdpwr ; do
     if [ $(lscfg -vl $hdpwr | grep -c SYMMETRIX) -ge 1 ] ; then
          hdsize=$(getconf DISK_SIZE /dev/${hdpwr})
          (( hdsum += hdsize ))
          print -u3 "$hdpwr has size $hdsize"
     fi
done
print -u3 "Sum over all SYMMETRIX disks: $hdsum"
exec 3>&-

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
# 4  
Old 06-04-2012
Hi,

Thank you I will give it a try on monday and let you know how it goes. Thanks for your help!

---------- Post updated 06-04-12 at 09:30 AM ---------- Previous update was 06-03-12 at 11:06 AM ----------

That worked amazing I edited it to make columns so i could put it straight onto a spread sheet

Thank you so much!!!

Moderator's Comments:
Mod Comment edit by bakunin: You are welcome. I changed the threads title to "solved".

Last edited by bakunin; 06-05-2012 at 04:41 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help on filtering

Hi experts, I have a file image.csv as below: COMPUTERNAME,23/07/2013,22/07/2013,21/07/2013,20/07/2013,19/07/2013,18/07/2013,17/07/2013 AED03852180,3,3,3,3,3,3,3 AED03852181,3,3,3,3,3,3,1 AED09020382,3,0,3,0,3,3,3 AED09020383,1,3,3,3,2,1,3 AED09020386,3,3,0,3,3,0,3 ... (4 Replies)
Discussion started by: zaq1xsw2
4 Replies

2. Shell Programming and Scripting

Filtering out rows

# powermt display dev=all .... snipped ... Pseudo name=hdiskpower8 Symmetrix ID=000192602584 Logical device ID=059F state=alive; policy=SymmOpt; priority=0; queued-IOs=0 ============================================================================== ---------------- Host --------------- ... (7 Replies)
Discussion started by: Daniel Gate
7 Replies

3. UNIX for Dummies Questions & Answers

filtering out certain output

hi guys, i have a long output and cant figure out a flexible way to show the meta members from a device. please help. some device have 2,4 or 8 meta members but for this example i have 4 meta members, what is a flexible way to pull them out from this output? need your inputs thanks. ... (4 Replies)
Discussion started by: prodigy06
4 Replies

4. Shell Programming and Scripting

text filtering

INPUT FILE: Date: 10-JUN-12 12:00:00 B 0: 00 00 00 00 10 00 16 28 B 120: 00 00 00 39 53 32 86 29 Date: 10-JUN-12 12:00:10 B 0: 00 00 00 00 10 01 11 22 B 120: 00 00 00 29 23 32 16 29 Date: 10-JUN-12 12:00:20 B 0: 00 00 00 00 10 02 17 29 B 120: 00 00 35 51 42 66 14 Date: 10-JUN-12... (5 Replies)
Discussion started by: thibodc
5 Replies

5. UNIX for Dummies Questions & Answers

Filtering the duplicates

Hello, I want to filter all the duplicates of a record to one place. Sample input and output will give you better idea. I am new to unix. Can some one help me on this? Input: 7488 7389 chr1.fa chr1.fa 3546 9887 chr5.fa chr9.fa 7387 7898 chrX.fa chr3.fa 7488 7389 chr1.fa chr1.fa... (2 Replies)
Discussion started by: koneru_18
2 Replies

6. Shell Programming and Scripting

Filtering

Hi I am interested in DNS resolving a set of sites and each time the output is different- $ host www.yahoo.com www.yahoo.com is an alias for fd-fp3.wg1.b.yahoo.com. fd-fp3.wg1.b.yahoo.com is an alias for ds-fp3.wg1.b.yahoo.com. ds-fp3.wg1.b.yahoo.com is an alias for... (1 Reply)
Discussion started by: jamie_123
1 Replies

7. Shell Programming and Scripting

filtering with awk

i have question about awk ex: input.txt 1252468812,yahoo,3.5 1252468812,hotmail,2.4 1252468819,yahoo,1.2 msn,1252468812,8.9 1252468923,gmail,12 live,1252468812,3.4 yahoo,1252468812,9.0 1252468929,msn,1.2 output.txt 1252468812,yahoo,3.5 1252468812,hotmail,2.4 msn,1252468812,8.9... (3 Replies)
Discussion started by: zvtral
3 Replies

8. Shell Programming and Scripting

Please help me to do some filtering

I have to grep a pattern. scenario is like :- Suppose "/etc/sec/one" is a string, i need to check if this string contains "one" using any utility something like if /etc/sec/one | grep ; then Thanks in advance Renjesh Raju (3 Replies)
Discussion started by: Renjesh
3 Replies

9. Shell Programming and Scripting

filtering the logs

Hi, We are using rsync for syncing remote directories. It is working great along with detailed logs. As the script cron'd and most of the times there're no files to sync we are getting lot of unnecessary log entries and we need to filter them to show only the log entries for the files... (5 Replies)
Discussion started by: prvnrk
5 Replies

10. HP-UX

port filtering

hi All I have to do port filtering on Unix servers.But unfortunately ip filter is not installed on the server.Now i am thinking of stopping the services.Can anybody tell me how do i go about it?Somebody told me about etc/services option?But that does not look a viable option.I think that is only... (0 Replies)
Discussion started by: ujjwalmohan
0 Replies
Login or Register to Ask a Question