Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to use xml_grep to get the value of an attribute? Post 302756647 by Yoda on Wednesday 16th of January 2013 08:45:53 AM
Old 01-16-2013
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

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

File Created On attribute

Hi, I need to find out when a file has been created. 'ls -l' just lists the last date the file was modified. I have also noticed when viewing the attributes through NT, the last modified date is the same as the file creation date. I thought maybe this was a fault due to samba. I guess what... (1 Reply)
Discussion started by: dpalmer
1 Replies

2. Linux

File attribute Help please

Could anyone help i have a question that i have a problem with for my home work it is, How do i change file permissions in a command line enviromet thanx (1 Reply)
Discussion started by: Cube3k
1 Replies

3. Shell Programming and Scripting

Dynamic Attribute Changes

Hello , I am stuck out in a part of my script, though I am trying it through a script of loops but i emphasis on having a short code : Input file has Attribute values changing with time Date Monday October 30 10:22:56 IST 2006 object values references Date ... (8 Replies)
Discussion started by: er_aparna
8 Replies

4. Red Hat

Password Attribute

Hello Friends , Where do i check the following settings in redhat ? 1. Minimum required number of characters in the password (passwordMinLength) 2. Minimum number of digit characters, meaning numbers between zero and nine (passwordMinDigits) 3. Minimum number of ASCII alphabetic... (2 Replies)
Discussion started by: avklinux
2 Replies

5. AIX

login attribute settign

Dears i need some assistance in implementing following scenario, as per audit observation we have restrict remote log in of specific users after official hours by clients, but the same user needs to be log in from LFT console round the clock(or any time after logout,because certain application... (1 Reply)
Discussion started by: m_raheelahmed
1 Replies

6. Linux

Unable to get terminal attribute!

Hi, I'm using scli (Command line utility) to retrieve the information about qlogic HBA and I want to redirect the information to text file. * While execution I'm getting the following warning "Unable to get terminal attribute!" How to avoid that ? because of this "Unable to get terminal... (3 Replies)
Discussion started by: shausy
3 Replies

7. Solaris

Solaris Attribute Problems

When I modify the file attributes of files and run a ls -l to view the changes everything looks correct, however when I run the init 6 to reboot the server the file attributes devert back to the origininal read only permissions. Any help would be appreciated (2 Replies)
Discussion started by: jimcz2it
2 Replies

8. Solaris

ldapclient can not modify attribute

Hello, We have one Solaris 10 machine which has three LDAP servers configured. We want to remove one of them. I tried below ldapclient command however no change is made. ---------------------------------------------------------------------- ldapclient mod -a "defaultServerList=10.149.9.20... (0 Replies)
Discussion started by: alfa_w
0 Replies

9. Red Hat

(.) at the end of file attribute.

Hi Linux Experts, I am using RHEL 6.4, on checking I identified some files ends with the file attribute like dot (.) at the end. Whereas, I checked with the same level of other servers and I don't identify dot(.) at the end of file attribute. Why is it so? is there any meaning for it. ... (3 Replies)
Discussion started by: gsiva
3 Replies

10. Shell Programming and Scripting

How to change a PS attribute?

Hi, i want to list all system processes showing the attributes pid, user name, cpu consumption, and the difference between the resident memory and the swap memory needed to stock the process in case of suspending it. i have two questions, the resident memory is the attribute size i think,... (4 Replies)
Discussion started by: Eskizoide
4 Replies
XML_GREP(1)						User Contributed Perl Documentation					       XML_GREP(1)

NAME
xml_grep - grep XML files looking for specific elements SYNOPSYS
xml_grep [options] <file list> or xml_grep <xpath expression> <file list> By default you can just give "xml_grep" an XPath expression and a list of files, and get an XML file with the result. This is equivalent to writing xml_grep --group_by_file file --pretty_print indented --cond <file list> OPTIONS
--help brief help message --man full documentation --Version display the tool version --root <cond> look for and return xml chunks matching <cond> if neither "--root" nor "--file" are used then the element(s) that trigger the "--cond" option is (are) used. If "--cond" is not used then all elements matching the <cond> are returned several "--root" can be provided --cond <cond> return the chunks (or file names) only if they contain elements matching <cond> several "--cond" can be provided (in which case they are OR'ed) --files return only file names (do not generate an XML output) usage of this option precludes using any of the options that define the XML output: "--roots", "--encoding", "--wrap", "--group_by_file" or "--pretty_print" --count return only the number of matches in each file usage of this option precludes using any of the options that define the XML output: "--roots", "--encoding", "--wrap", "--group_by_file" or "--pretty_print" --strict without this option parsing errors are reported to STDOUT and the file skipped --date when on (by default) the wrapping element get a "date" attribute that gives the date the tool was run. with "--nodate" this attribute is not added, which can be useful if you need to compare 2 runs. --encoding <enc> encoding of the xml output (utf-8 by default) --nb_results <nb> output only <nb> results --by_file output only <nb> results by file --wrap <tag> wrap the xml result in the provided tag (defaults to 'xml_grep') If wrap is set to an empty string ("--wrap ''") then the xml result is not wrapped at all. --nowrap same as using "--wrap ''": the xml result is not wrapped. --descr <string> attributes of the wrap tag (defaults to "version="<VERSION>" date="<date>"") --group_by_file <optional_tag> wrap results for each files into a separate element. By default that element is named "file". It has an attribute named "filename" that gives the name of the file. the short version of this option is -g --exclude <condition> same as using "-v" in grep: the elements that match the condition are excluded from the result, the input file(s) is (are) otherwise unchanged the short form of this option is -v --pretty_print <optional_style> pretty print the output using XML::Twig styles ('"indented"', '"record"' or '"record_c"' are probably what you are looking for) if the option is used but no style is given then '"indented"' is used short form for this argument is -s --text_only Displays the text of the results, one by line. --html Allow HTML input, files are converted using HTML::TreeBuilder --Tidy Allow HTML input, files are converted using HTML::Tidy Condition Syntax <cond> is an XPath-like expression as allowed by XML::Twig to trigger handlers. exemples: 'para' 'para[@compact="compact"]' '*[@urgent]' '*[@urgent="1"]' 'para[string()="WARNING"]' see XML::Twig for a more complete description of the <cond> syntax options are processedby Getopt::Long so they can start with '-' or '--' and can be abbreviated ("-r" instead of "--root" for example) DESCRIPTION
xml_grep does a grep on XML files. Instead of using regular expressions it uses XPath expressions (in fact the subset of XPath supported by XML::Twig) the results can be the names of the files or XML elements containing matching elements. SEE ALSO
XML::Twig Getopt::Long LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. AUTHOR
Michel Rodriguez <mirod@xmltwig.com> perl v5.16.3 2012-05-17 XML_GREP(1)
All times are GMT -4. The time now is 06:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy