![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
lspv | awk -v q="'" '{ print "lspv",$1" | egrep " q "PP\|PHYSICAL" q "; lspv -l",$1 }'
|
|
#3
|
|||
|
|||
|
Thanks, vgersh99!
|
|||
| Google The UNIX and Linux Forums |