|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to use xml_grep to get the value of an attribute?
I'm using xml_grep command to get the value of different tags in a xml-file. No i also need the value of an attribute in a tag. Can I use xml_grep for this? Does anybody know how? ex. : Code:
<Name xmlns:xsi="http://www.w3.org/2001/XMLinst" xsi:spaceSchema="Name_5879.xsd"> ... </Name> I need the value of xsi:spaceSchema > Name_5879.xsd Last edited by Scott; 01-16-2013 at 10:30 AM.. Reason: Please use code tags. NOTE: I added a missing < before /Name> |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
I'm not sure about using xml_grep, below is an awk program to get the value of attribute:- Code:
awk -F"=" '{for(i=1;i<=NF;i++) { if($i~/xsi:spaceSchema/) v=$(i+1); } } END { gsub(/"|>/,"",v); print v; } ' xml |
| Sponsored Links | ||
|
![]() |
| Tags |
| attribute, tag, unix, xml |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ldapclient can not modify attribute | alfa_w | Solaris | 0 | 04-05-2012 09:29 PM |
| Solaris Attribute Problems | jimcz2it | Solaris | 2 | 01-29-2012 04:05 PM |
| Password Attribute | avklinux | Red Hat | 2 | 06-09-2009 05:52 PM |
| Dynamic Attribute Changes | er_aparna | Shell Programming and Scripting | 8 | 10-30-2006 11:57 PM |
| File attribute Help please | Cube3k | Linux | 1 | 12-15-2003 04:31 PM |
|
|