|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
extra space issue with awk
Code:
for diskname in $(lspv |awk '{print $1}')
do
lquerypv -h /dev/|awk '/'$diskname'/ { print ; exit }'
doneNo output is returning from the loop. I think awk put an extra space to the command - lquerypv -h /dev/ so that the command is executed as i.e. lquerypv -h /dev/ hdisk230 with a space between /dev/ and hdisk230. Please advise how to remove an extra space in this case if my guess is correct. Thank you |
| Sponsored Links | |
|
|
|
#2
|
||||
|
||||
|
Do: Code:
lspv |awk '{print "="$1"="}'so you don't have to guess
|
| Sponsored Links | ||
|
|
|
#3
|
|||
|
|||
|
Code:
lspv |awk '{print "="$1"="}'returns the outputs with = Code:
=hdisk0= =hdisk1= =hdisk113= ... Code:
lspv |awk '{print "/dev/"$1}'gives me like this: Code:
/dev/hdisk0 /dev/hdisk1 /dev/hdisk113 ... It looks good so far, but if I put in Code:
for diskname in $(lspv |awk '{print "/dev/"$1}')
do
lquerypv -h |awk '/'$diskname'/ { print ; exit }'
doneI am getting errors: Code:
Syntax Error The source line is 1.
The error context is
//dev/hdisk0/ >>> { <<<
awk: 0602-500 Quitting The source line is 1.
Syntax Error The source line is 1.
The error context is
//dev/hdisk1/ >>> { <<<
awk: 0602-500 Quitting The source line is 1.
Syntax Error The source line is 1.
The error context is
//dev/hdisk113/ >>> { <<<
awk: 0602-500 Quitting The source line is 1.Please advise. Thank you so much Last edited by Scott; 09-03-2010 at 04:46 PM.. Reason: Code tags, please... |
|
#4
|
||||
|
||||
|
Try: Code:
for diskname in $(lspv |awk '{print $1}')
do
lquerypv -h /dev/|awk -vx=$diskname '$0~x{ print ; exit }'
done |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
I tried: Code:
for diskname in $(lspv |awk '{print $1}')
do
lquerypv -h /dev/|awk -vx=$diskname '$0~x{ print ; exit }'
donebut, no output is returned still. Please advise. |
| Sponsored Links | |
|
|
#6
|
||||
|
||||
|
Are you sure this command is giving proper output? (containing disk names?): Code:
lquerypv -h /dev/ |
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
The command has to be: Code:
lquerypv -h /dev/hdisk# // please note no space on Code:
/dev/hdisk# hdisk# comes from Code:
'/'$diskname'/ { print ; exit }'It looks to me that i.e. Code:
lquerypv -h /dev/ hdisk0 (please note a space) is executed. Please advise. |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Issue with disk space usage | figaro | UNIX Desktop for Dummies Questions & Answers | 2 | 06-26-2010 03:39 AM |
| Issue with insufficient swap or memory space | kavithakuttyk | UNIX for Advanced & Expert Users | 3 | 09-25-2009 01:02 PM |
| Issue available disk space while using xdd | mrpogo07 | Filesystems, Disks and Memory | 3 | 09-23-2009 05:56 PM |
| Need help with space issue | bbbngowc | UNIX for Dummies Questions & Answers | 1 | 09-22-2008 02:34 PM |
| Space issue with Directory | siba.s.nayak | UNIX for Dummies Questions & Answers | 1 | 06-03-2008 07:14 AM |
|
|