Hi All,
Currently, the output looks like this:
hdisk0
queue_depth:3
hdisk1
queue_depth:3
hdisk2
queue_depth:1
hdisk3
queue_depth:1
I need to change the format to look like this:
hdisk0 queue_depth:3
hdisk1 queue_depth:3
hdisk2 queue_depth:1
hdisk3 queue_depth:1
Thanks very much!
nawk 'ORS=(FNR%2)?FS:RS' myFile
peterro
3
Is that output of your script or a flat file? What is generating this output?
for i in `lspv | awk '{print $1}`
do
print $i
lsattr -El $i | grep queue_depth | awk '{print $1 ":" $2}'
done
The output looks like this
hdisk0
queue_depth:3
hdisk1
queue_depth:3
hdisk2
queue_depth:1
hdisk3
queue_depth:1
how can I change to
hdisk0 queue_depth:3
hdisk1 queue_depth:3
hdisk2 queue_depth:1
hdisk3 queue_depth:1
---------- Post updated at 05:04 PM ---------- Previous update was at 04:54 PM ----------
It works perfectly. Thanks so much vgersh99. You're the guru !
peterro
5
instead of
print $i
you could
echo -n $i
or
for i in `lspv | awk '{print $1}`
do
attribute=`sattr -El $i | grep queue_depth | awk '{print $1 ":" $2}'`
print $i $attribute
done
skmdu
7
$ sed -n 'N;s/\n/ /p' inputfile
hdisk0 queue_depth:3
hdisk1 queue_depth:3
hdisk2 queue_depth:1
hdisk3 queue_depth:1
ripat
9
Pity that OP didn't even try that elegant awk solution rather than the loop in bash with tons of piping!