Alexandre CHARTRE - Solaris Sustaining wrote: > A problem is that mdb pipes only accept pointers and they don't accept > other text. But you can do what you want using two steps: > somedcmds ! grep "addr = 0x" | awk '{print $3}' > /tmp/file > ::cat /tmp/file | otherdcmds > Yongce Tu wrote: ... >> I can use [i]somedcmds !grep "addr = 0x" | awk '{print $3}'[/i] to get >> the result. But i cannot do like this, because the output cannot be >> used in MDB and i expect the ouput can be used as input of some other >> dcmd. >> How to solve it?
This is, in my opinion, a gap in mdb's functionality. I've logged 6433722 mdb should allow me to print if a field matches rather than pipe to grep Here's the description field (all there is so far): ======================================================================== For a long time now I've wanted mdb to have a dcmd which will allow me to print out a structure (or structure members) only if a particular condition is met. For example, if I'm walking a list of fcp_lun and I want to see all the address of all luns which have (lun_mpxio = 1) and have a null lun_cip at present I have to walk the lunlist, counting lines, then walk the lunlist printing lun_mpxio and lun_cip and match up the output to the first list. This is darned tedious! What I envisage is a dcmd somewhat similar to this: ::printif {condition} [-o|-a] [-n] {condition-list} [structure members to print] (-o ==> or -a ==> and -n ==> not So for my example above I would then use *fcp_port_head::walk fcp::walk targets::walk luns::printif lun_mpxio==1 -a lun_cip==NULL and if I wanted to delve further I would then use something like this: *fcp_port_head::walk fcp::walk targets::walk luns::printif \ lun_mpxio==1 -a lun_cip==NULL \ lun_inq.inq_vid lun_inq.inq_pid lun_inq.inq_revision \ lun_inq.inq_serial *** (#1 of 1): 2006-06-05 17:36:21 EST james.mcpherson at sun.com ======================================================================== -- James C. McPherson -- Solaris Datapath Engineering Data Management Group Sun Microsystems