Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Parsing XML dynamic data via awk? Post 9775 by rwb1959 on Friday 2nd of November 2001 11:34:00 AM
Old 11-02-2001
If you REALLY, REALLY want to use awk, I guess you can
do somthing like...

Code:
#!/bin/sh
awk '/<Number>/ {stp=index($0,">")+1; \
newstr=substr($0,stp); \
etp=index(newstr,"<")-1; \
print substr(newstr,0,etp); \
}' test.xml

...the test.xml data file is...

Code:
<String>one</String>
<Number>two</Number>
<String>three</String>
<Number>four</Number>

... the awk program will output the "data" on the
"<Number>" lines only.

I hope this encourages you to look at Perl again. Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parsing and getting data from XML file using ksh script

Hi All, I have a xml file for example as described below <xml> <address> <street><street> <address/> <isbn>426728783932020308393930303</isbn> <book> <name> </name> </book> . . . </xml> My problem is to get the isbn number from the above described file using ksh script. Could... (6 Replies)
Discussion started by: vinna
6 Replies

2. Shell Programming and Scripting

parsing xml using awk

hello , i am trying to parse xml using awk however its a little bit tricky as i want <databases> <source> <host>prod</host> <port>1522</port> <tns>GP1</tns> <user>P11</user>... (6 Replies)
Discussion started by: amit1_x
6 Replies

3. Shell Programming and Scripting

Parsing posted XML data from a remote server?

Hi Is it possible to parse a posted xml data from a remote server in unix shell script. if so how to do that? and i need to give this script path in the push url (in remote server) . how to do this? I have tried this in asp but could not succeed....so am trying in shell scripting...the thread... (1 Reply)
Discussion started by: aemunathan
1 Replies

4. Shell Programming and Scripting

Parsing dynamic data from a command output

Hi people, I am writing a korn shell script, and one of the command gives an output something like below: release.label.2010.03.02 objects: /project/path/to/some/file_name.ksh /project/path/another/file_name01.dat I have to retrieve the file paths one by one & use them as... (9 Replies)
Discussion started by: kiwin1000
9 Replies

5. Shell Programming and Scripting

parsing data from xml file is failing can't open variable

Created a korn shell script, everything is is working except this section, the variable $SYSINFO is being set, but the NASIP & NASDEV are failing, it appears to be treating the config.xml file config directory and xml as the file. Need a second set of eyes to tell me where I am messing up. #... (3 Replies)
Discussion started by: juanb25
3 Replies

6. Shell Programming and Scripting

xml parsing with awk

hi all.. need your help again.. i have xml file and i want to parsing some data from the xml file.. <ex-name="keroco"> <................> <................> <................> <br-name="cincai"> <ship="123456"> <...................> ... (3 Replies)
Discussion started by: buncit8
3 Replies

7. Shell Programming and Scripting

Help - Parsing data in XML in Linux

Hi, I have an XML file in Linux and it contains a long string of characters. The last part of the file is like ....... ....... ....... CAD</MarketDescription></InvestorTransaction></AdvisorAccount></DivisionAdvisor></Division>... (3 Replies)
Discussion started by: naveed
3 Replies

8. Shell Programming and Scripting

XML Parsing using awk

Hi All, I have a problem to resolve. For following XML file, I need to parse the values based on Tag Name. I would prefer to use this by awk. I have used sed command to replace the tags (s/<SeqNo>//). In this case there can be new tags introduced. So need to parse it based on Tag Name. Any... (9 Replies)
Discussion started by: Tons
9 Replies

9. Shell Programming and Scripting

Parsing XML (and insert data) then output data (bash / Solaris)

Hi folks I have a script I wrote that basically parses a bunch of config and xml files works out were to add in the new content then spits out the data into a new file. It all works - apart from the xml and config file format in the new file with XML files the original XML (that ends up in... (2 Replies)
Discussion started by: dfinch
2 Replies

10. Shell Programming and Scripting

Parsing custom data into xml in Shell

Hi , I have data as below in a text file { 'AAA' => { 'A1' => 'a1 comment', 'A2' => 'a2 comment' }, 'BBB' => { 'B1' => 'b1 comment' }, 'CCC' => { 'C1' => 'c1 comment', 'C2' => 'c2 comment', 'C3' => 'c3 comment' 'C4' => 'c4... (2 Replies)
Discussion started by: vivek d r
2 Replies
PMDASYSTEMTAP(1)					       Performance Co-Pilot						  PMDASYSTEMTAP(1)

NAME
pmdasystemtap - Systemtap performance metrics domain agent (PMDA) DESCRIPTION
pmdasystemtap is a Performance Metrics Domain Agent (PMDA) which exports metric values from the Linux Systemtap dynamic tracing toolkit. This implementation uses the stap(1) tool, which is a front-end to the Systemtap toolkit. INSTALLATION
In order to access performance data exported by Systemtap from with PCP, it is necessary to perform two configuration steps: 1. Configure Systemtap probes, and verify them with stap(1). These should be produced in a format that is easily parsed, and then stored in the $PCP_PMDAS_DIR/systemtap/probes.stp file. 2. Configure pmdasystemtap to extract the values from the text produced by stap. Two example probes are implemented in the default systemtap PMDA script - readdir and sync traces (see $PCP_PMDAS_DIR/systemtap/pmdasystemtap.pl for details). # cd $PCP_PMDAS_DIR/systemtap # [ edit probes.stp, test /usr/bin/stap probes.stp ] # [ edit pmdasystemtap.pl ] Once this is setup, you can access the names and values for the systemtap performance metrics by doing the following as root: # cd $PCP_PMDAS_DIR/systemtap # ./Install If you want to undo the installation, do the following as root: # cd $PCP_PMDAS_DIR/systemtap # ./Remove pmdasystemtap is launched by pmcd(1) and should never be executed directly. The Install and Remove scripts notify pmcd(1) when the agent is installed or removed. FILES
$PCP_PMDAS_DIR/systemtap/probes.stp probe configuration file for stap(1), run by pmdasystemtap $PCP_PMDAS_DIR/systemtap/Install installation script for the pmdasystemtap agent $PCP_PMDAS_DIR/systemtap/Remove undo installation script for the pmdasystemtap agent $PCP_LOG_DIR/pmcd/systemtap.log default log file for error messages from pmdasystemtap SEE ALSO
pmcd(1) and stap(1). 3.8.10 Performance Co-Pilot PMDASYSTEMTAP(1)
All times are GMT -4. The time now is 03:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy