473,480 Members | 1,833 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Easiest way to parse text from xml file (sed, awk, shell?)

Colloid Snake
144 New Member
Hey everyone. I'm currently attempting to band-aid an horrible use of a Cacti implementation (and I swear, this is only temporary! No, really! They told me it's in the budget for next year, and has already been approved... I hope...) Anyway... I am using rrdtool to dump the data into an xml file.

So this xml file is going to have several hundred (possibly thousand) lines that consist of:
<some tag I'm forgetting> <some other tag> datestamp </some other tag> <v> (either NaN or 0.0000000000000000000000e1)</v> </some tag I'm forgetting>

I apologize for my wonderfully specific detail in there, but I had a systems crash last night, which means I can't ssh into the cacti box (I forgot the IP :( ), or pull up the xml or rrd files I had on my local computer - sorry!.

My goal is to do two things - make sure the date is within a week of the date parsed (this is going to be in cron), and increment either of two counters (one for NaN, one for the .0000whatever). There are approximately 300 hosts/rrd files that I have to do this for, I believe the rrd files contain data from the last month, so there's a good portion of the data I will be dropping, and I was wondering if there was an "easy" language in which to do the date comparison/incrementing. Right now it's all in shell, but that is just as a proof of concept for management, I haven't tried to parse through that xml file or read all the hostnames from the other cacti database yet, it seems like sed or awk might be more convenient, or should I just try to do the whole thing in python or perl or something?

Any input is appreciated.
Jul 2 '07 #1
1 21845
cnemo
1 New Member
check it out: SED to parse and modify XML element nodes

hope it helps,
cnemo
Sep 24 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
9106
by: Rigga | last post by:
Hi, I am new to Python and need to parse a text file and cut parts out i.e. say the text file contained 5 rows of text: line 1 of the text file line 2 of the text file line 3 of the text...
0
11987
by: John M. Lembo | last post by:
I am using Perl to parse a text file and output to another file. The text file has data on Unix virtual memory (vmstat) and I want to delete lines that I don't want and output lines that I want to...
2
12061
by: Tyaan | last post by:
Hi.. I'm a perl noob need to know how to write a script to parse a file containing one to four of the following blocks of text? I then want to print the results in a format showing the memory size...
6
5010
by: Porky | last post by:
I have an asp page that successfully writes out the form data to a text file. I would like to use Blat (or other free email utility) to send the contents of the text file to a user. The code to...
2
15540
by: Sacha Korell | last post by:
How would I check for an end of file when parsing a text file using the StreamReader object? I would like to do something like this: '******************************** Dim objStreamReader As...
3
18691
by: boukaka | last post by:
Hi there, I have a text file that does not have any delimiters - it is simply assumed that I know how long each field is and they are always in the same order. (i.e. JOHN DOE ...
13
2360
by: gavino | last post by:
This seems easy but I have been asking tcl and python IRC chat all day and no one gave an answer. I have 100 servers which need a new backup server added to a text file, and then the backup agent...
15
9867
by: batman | last post by:
i have a text file that is like: date = OCT0606 asdf sdaf asdfasdgsdgh asdfsdfasdg START-OF-DATA asdfasdfg asdfgdfgsfg
1
5933
by: ljungers | last post by:
Help needed with shell script using the sed command. Need to extract a date from a text file. Each record contains the text "Date Entered:" and following that literial is a space followed by...
0
941
by: =?Utf-8?B?TW9ydGVuIFdlbm5ldmlrIFtDIyBNVlBd?= | last post by:
"DavidM" wrote: That is correct. My code only checks for a single "Blocks used" section. If there are more just run the method again with the same binaryreader, or find the next matching...
0
7052
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7092
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6744
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6981
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5348
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4790
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
2989
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
565
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.