The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > AIX
Google UNIX.COM


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Egrep cheat sheet anywhere? Looking for meaning of egrep -c leelm UNIX for Dummies Questions & Answers 2 01-11-2008 12:37 PM
Formatting Substitution Command Not Working in vi ERPKEN UNIX for Advanced & Expert Users 11 05-06-2007 06:36 PM
egrep command annelisa Shell Programming and Scripting 4 07-05-2006 01:33 AM
is running this command via ssh possible? (formatting issues) LordJezo Shell Programming and Scripting 1 08-19-2005 05:40 AM
trouble using mailx command ldrojasm Shell Programming and Scripting 2 04-03-2002 02:52 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 03-22-2006
Registered User
 

Join Date: Nov 2005
Posts: 10
Trouble formatting egrep command with AWK

Hi,
I'm new to scripting and AIX. I'm running the following:

lspv | awk '{ print "lspv",$1" | egrep 'PP\|PHYSICAL'; lspv -l",$1 }'

Which creates this command:

lspv hdisk0 | egrep PP|PHYSICAL; lspv -l hdisk0
lspv hdisk1 | egrep PP|PHYSICAL; lspv -l hdisk1

Troube is, I need the patterns for egrep to be enclosed in single quotes
lspv hdisk0 | egrep 'PP|PHYSICAL'; lspv -l hdisk0
lspv hdisk1 | egrep 'PP|PHYSICAL'; lspv -l hdisk1

I thought using backslashes would help:
lspv | awk '{ print "lspv",$1" | egrep \'PP\|PHYSICAL\'; lspv -l",$1 }'

but get the same results:
lspv hdisk0 | egrep PP|PHYSICAL; lspv -l hdisk0
lspv hdisk1 | egrep PP|PHYSICAL; lspv -l hdisk1

I've entered the command manualy to get the desired results, below:

root@test:/ > lspv hdisk1 | egrep 'PP|PHYSICAL'; lspv -l hdisk1
PHYSICAL VOLUME: hdisk1 VOLUME GROUP: sanvg
PP SIZE: 16 megabyte(s) LOGICAL VOLUMES: 5
TOTAL PPs: 955 (15280 megabytes) VG DESCRIPTORS: 2
FREE PPs: 534 (8544 megabytes) HOT SPARE: no
USED PPs: 421 (6736 megabytes) MAX REQUEST: 256 kilobytes
hdisk1:
LV NAME LPs PPs DISTRIBUTION MOUNT POINT
sas 52 52 00..52..00..00..00 /sas
worktest 326 326 07..128..191..00..00 /worktest
db2data1 32 32 32..00..00..00..00 /db2data1
loglv00 1 1 00..01..00..00..00 N/A
scripts 10 10 00..10..00..00..00 /scripts


Any ideas?
Reply With Quote
Forum Sponsor
  #2  
Old 03-22-2006
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
Code:
lspv | awk -v q="'" '{ print "lspv",$1" | egrep " q "PP\|PHYSICAL" q "; lspv -l",$1 }'
Reply With Quote
  #3  
Old 03-22-2006
Registered User
 

Join Date: Nov 2005
Posts: 10
Thanks, vgersh99!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:43 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0