awk not picking up /PP SIZE/


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk not picking up /PP SIZE/
# 1  
Old 07-11-2012
awk not picking up /PP SIZE/

PHP Code:
for vgls in `lsvg`
do
lsvg $vgls awk '/^VOLUME GROUP/ { printf "%s ", $3 } /PP SIZE/ { S=$6 }
/TOTAL PPs/ { printf "%d ", $6*S/1024 }
/FREE PPs/ { print $6*S/1024 }
'
done 
This returns /TOTAL PPs/ and /FREE PPs/ fine, but not /PP SIZE/.
Please advise.
# 2  
Old 07-11-2012
for-loops are no good for this kind of thing. They break the input into words, which is no good if you're looking for more than one word (i.e. VOLUME GROUP)

Code:
lsvg $(lsvg) | awk '/^VOLUME GROUP/ { printf "%s ", $3 } /PP SIZE/ { S=$6 } 
/TOTAL PPs/ { printf "%d ", $6*S/1024 } 
/FREE PPs/ { print $6*S/1024 } 
'

# 3  
Old 07-11-2012
My doc on lsvg shows "PP size". The regex is case-sensitive.
Please post the output of
Code:
lsvg [one volg name]

# 4  
Old 07-11-2012
Quote:
Originally Posted by jim mcnamara
My doc on lsvg shows "PP size". The regex is case-sensitive.
Please post the output of
Code:
lsvg [one volg name]

It is:
HTML Code:
lsvg rootvg
VOLUME GROUP:       rootvg                   VG IDENTIFIER:  00c701f000004c0000000131720db73f
VG STATE:           active                   PP SIZE:        128 megabyte(s)
VG PERMISSION:      read/write               TOTAL PPs:      1092 (139776 megabytes)
MAX LVs:            256                      FREE PPs:       734 (93952 megabytes)
LVs:                13                       USED PPs:       358 (45824 megabytes)
OPEN LVs:           12                       QUORUM:         1 (Disabled)
TOTAL PVs:          2                        VG DESCRIPTORS: 3
STALE PVs:          0                        STALE PPs:      0
ACTIVE PVs:         2                        AUTO ON:        no
MAX PPs per VG:     32512                                     
MAX PPs per PV:     1016                     MAX PVs:        32
LTG size (Dynamic): 256 kilobyte(s)          AUTO SYNC:      no
HOT SPARE:          no                       BB POLICY:      relocatable 
---------- Post updated at 11:34 AM ---------- Previous update was at 11:34 AM ----------

Quote:
Originally Posted by Scott
for-loops are no good for this kind of thing. They break the input into words, which is no good if you're looking for more than one word (i.e. VOLUME GROUP)

Code:
lsvg $(lsvg) | awk '/^VOLUME GROUP/ { printf "%s ", $3 } /PP SIZE/ { S=$6 } 
/TOTAL PPs/ { printf "%d ", $6*S/1024 } 
/FREE PPs/ { print $6*S/1024 } 
'

It is still not pulling out PP SIZE....
# 5  
Old 07-11-2012
What exactly is the output you are looking for?
# 6  
Old 07-11-2012
I think I see a typo there. Without a newline after the VOLUME GROUP statement, it takes it to be part of that statement instead of a new one.

Code:
awk '/^VOLUME GROUP/ { printf "%s ", $3 }
/PP SIZE/ { S=$6 } 
/TOTAL PPs/ { printf "%d ", $6*S/1024 } 
/FREE PPs/ { print $6*S/1024 } 
'

# 7  
Old 07-11-2012
That shouldn't matter.

It is picking up the PP SIZE just fine.

Code:
lsvg $(lsvg) | awk '/^VOLUME GROUP/ { print $3 } /PP SIZE/ { print $6 } 
/TOTAL PPs/ { print $6 } 
/FREE PPs/ { print $6 } 
'
rootvg
128
1092
734

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Picking up last two specific files, for transfer

Hi I need to transfer files with csv extension from one server to another (all running solaris). But the files to be picked are in a directory that also has: /directory deposit_698.csv deposit_698.checksum deposit_699.csv deposit_699.checksum deposit_700.csv deposit_700.checksum... (15 Replies)
Discussion started by: fretagi
15 Replies

2. UNIX for Beginners Questions & Answers

Cherry picking with sed?

#!/bin/bash shuffle() { Deck=$(shuf -e {2,3,4,5,6,7,8,9,T,J,Q,K,A}{H,S,D,C}) } PH=(6H 9S KC) # playerhand CH=(JD 4D) # computerhand AC=2S # activecard shuffle echo $Deck I am unsure about how to proceed. I want to reshuffle a deck but without the cards in... (3 Replies)
Discussion started by: cogiz
3 Replies

3. Shell Programming and Scripting

Picking up files conditionally

Hi I have a scenario: I have a directory say DIR1 (no sub directories) and have few files in that directory as given below: app-cnd-imp-20150820.txt app-cxyzm-imp-20150820.txt app-petco-imp-20150820.txt app-mobility-imp-20150820.txt app-mobility-imp-20150821.txt... (7 Replies)
Discussion started by: Saanvi1
7 Replies

4. Shell Programming and Scripting

Picking values from a file.

Hi, I have a file which contains values in this format. abc cde fgh ijk lmn opq rst uvw The user will pass the required parameter from the command line. My requirement is that script should pick the values passed by the user and the next value in the next line. Like if the user... (10 Replies)
Discussion started by: arijitsaha
10 Replies

5. Shell Programming and Scripting

Picking matching strings

I have a list of file names. However in some instances I might have a "-" at the beginning of the filename or an "=". For example I might have something like this set Lst = "file1 file2 file3 -file4 file5=" I want to pick up the ones having "-" at the beginning or "=" and store them in... (22 Replies)
Discussion started by: kristinu
22 Replies

6. AIX

Not picking up the GNU version of make

Hi team, I am new to unix,and need your advice on the below. I am using aix5.3 and have installed make-3.82 on the server. I need to use gmake for configuring and installing a package ,but it is giving error at the below root@sapsrp:/usr/tmp/xymon-4.3.2 # ./configure.server ... (7 Replies)
Discussion started by: sonal kumar
7 Replies

7. Shell Programming and Scripting

need help on picking a right book

hi, I'm searching for a perfect book to learn awk programming, i started with sed&awk book, but i think this book might be outdated as it is written way back in 97 and also it doesn't have many examples. So, I thought of getting some advice from the experts here. Pls suggest me some books. ... (1 Reply)
Discussion started by: dvah
1 Replies

8. UNIX for Dummies Questions & Answers

Picking problem with printers

Hello to everybody i have problem the picking process falls and falls. I dont now what the picking process do i believe that is a print server on a data base i dont know where to look. Is a solaris 10 with korn sheell the process show this ps -ef | grep picking batch 18466 1 0... (5 Replies)
Discussion started by: enkei17
5 Replies

9. UNIX for Advanced & Expert Users

Using awk : picking specified columns

Hi, I would like to get some specific fields from one long line. My line looks like CcnCDRFile0-8535123473201007170536_2010-07-20_17:06:02:,,9963387265,,,,,00720141432,,+0.310,+79.255,+78.945,,,,1492,,,,0,... (1 Reply)
Discussion started by: kkarthik_kaja
1 Replies

10. Shell Programming and Scripting

Problem with awk awk: program limit exceeded: sprintf buffer size=1020

Hi I have many problems with a script. I have a script that formats a text file but always prints the same error when i try to execute it The code is that: { if (NF==17){ print $0 }else{ fields=NF; all=$0; while... (2 Replies)
Discussion started by: fate
2 Replies
Login or Register to Ask a Question