Sponsored Content
Top Forums Shell Programming and Scripting Parsing log file and print latest number in loop Post 302901869 by RudiC on Friday 16th of May 2014 05:55:43 AM
Old 05-16-2014
Not sure I grasp what you want to tell us, but to get at the very last of your numbers, don't print $6, but assign it to a variable which then you print in the END section.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

want to cat the latest log file created

everytime a new logfile get created at certain interval of time and i want a simple shell script program which cat the lastest log file when manually excuted (1 Reply)
Discussion started by: vkandati
1 Replies

2. Shell Programming and Scripting

Loop through files in dir, omit file with latest date

I want to loop through files in a directory but omit the file with the latest date in my list of files. How would I accomplish this? Thanks (2 Replies)
Discussion started by: stringzz
2 Replies

3. Shell Programming and Scripting

search latest version of log file

Have checked the forums and couldnt locate help on this. I want to grep a log file for a pattern using a script - I need to grep the latest log file and not sure how I am able to ensure I am greping the latest log file. Here is sample of log files for yestersday and I effectively need to grep... (10 Replies)
Discussion started by: frustrated1
10 Replies

4. Shell Programming and Scripting

how can i pick the latest log file as per below

in the below .. i want to pick the latest logfile which is having JPS.PR inside.. that means i want particularly "spgport040408041223.log:@@@@@@@@ 04:13:09 Adding: JPS.PR." which is latest among these.. is it possible to compare the current time with logfile time ? reptm@xblr0758rop>... (4 Replies)
Discussion started by: mail2sant
4 Replies

5. Shell Programming and Scripting

print number pyramid with for loop in unix

How can I print number pyramid with for loop(not while only for) in unix like: 1 22 333 4444 55555 ---------- Post updated at 09:09 AM ---------- Previous update was at 09:07 AM ---------- I forgot it is in ksh...I wrote a script in bash but it is nt wrkng in ksh... bash script... (12 Replies)
Discussion started by: joshilalit2004
12 Replies

6. Shell Programming and Scripting

parsing a file name and add a number

Hi, I have a file po8282.fmt998.fbi.mopac.x.macs.btt.txt . I want to parse the first field which is separated by "." and then find the number and add 1 to it. here is what I am doing to get the first field, but not sure how to only pick the number and add 1 to it... (5 Replies)
Discussion started by: rudoraj
5 Replies

7. Shell Programming and Scripting

Perl's buffered I/O is causing me to miss latest log file entries in log colorizer. How to fix?

I've been finding myself using a log file colorizer written in perl to reformat and colorize the output from many different programs. Mainly, however, I use it to make the output from "tail -f" commands more readable. The base perl script I use is based on "colorlogs.pl" available from the... (1 Reply)
Discussion started by: rcsteiner
1 Replies

8. Shell Programming and Scripting

parsing characters and number from a big file with brackets

I have a big file with many brackets () in it from which I need to parse number characters and numbers. Below is an example of my file 14 (((A__0:0.02,B__1:0.3)0:0.04,C__0:0.025)2:0.01),(D__0:0.00978,E__2:0.01031)1:0.00362; 15... (1 Reply)
Discussion started by: Lucky Ali
1 Replies

9. UNIX for Dummies Questions & Answers

Help on parsing Oracle RMAN output for string and print sections of a file

Hi, I need some advise on how to print 'sections' of the attached file. I am searching for some that says Marked Corrupt and print some lines after it. At the moment I am running the command below: sed -n -e '/Marked Corrupt/{N;N;p;}' rman_list_validate.txtThis gives me the following... (1 Reply)
Discussion started by: newbie_01
1 Replies

10. Shell Programming and Scripting

Parsing a control file loop

Hi, Let's say I have a control file like this: RHEL apple "echo apple" RHEL bravo "ls -l bravo*" RHEL church "chmod church.txt" SUSE drive "chown user1 drive.txt" SUSE eagle "echo "eagle flies"" SUSE feather "ls -l feather*" HP-UX google "sed 's/^Google.*$/&\ ACTION: go to... (14 Replies)
Discussion started by: The Gamemaster
14 Replies
Template::Plugin::XML::DOM(3pm) 			User Contributed Perl Documentation			   Template::Plugin::XML::DOM(3pm)

NAME
Template::Plugin::XML::DOM - Plugin interface to XML::DOM SYNOPSIS
# load plugin [% USE dom = XML.DOM %] # also provide XML::Parser options [% USE dom = XML.DOM(ProtocolEncoding = 'ISO-8859-1') %] # parse an XML file [% doc = dom.parse(filename) %] [% doc = dom.parse(file = filename) %] # parse XML text [% doc = dom.parse(xmltext) %] [% doc = dom.parse(text = xmltext) %] # call any XML::DOM methods on document/element nodes [% FOREACH node = doc.getElementsByTagName('report') %] * [% node.getAttribute('title') %] # or [% node.title %] [% END %] # define VIEW to present node(s) [% VIEW report notfound='xmlstring' %] # handler block for a <report>...</report> element [% BLOCK report %] [% item.content(view) %] [% END %] # handler block for a <section title="...">...</section> element [% BLOCK section %] <h1>[% item.title %]</h1> [% item.content(view) %] [% END %] # default template block converts item to string [% BLOCK xmlstring; item.toString; END %] # block to generate simple text [% BLOCK text; item; END %] [% END %] # now present node (and children) via view [% report.print(node) %] # or print node content via view [% node.content(report) %] # following methods are soon to be deprecated in favour of views [% node.toTemplate %] [% node.childrenToTemplate %] [% node.allChildrenToTemplate %] DESCRIPTION
This is a Template Toolkit plugin interfacing to the XML::DOM module. The plugin loads the XML::DOM module and creates an XML::DOM::Parser object which is stored internally. The parse() method can then be called on the plugin to parse an XML stream into a DOM document. [% USE dom = XML.DOM %] [% doc = dom.parse('/tmp/myxmlfile') %] The XML::DOM plugin object (i.e. 'dom' in these examples) acts as a sentinel for the documents it creates ('doc' and any others). When the plugin object goes out of scope at the end of the current template, it will automatically call dispose() on any documents that it has cre- ated. Note that if you dispose of the the plugin object before the end of the block (i.e. by assigning a new value to the 'dom' variable) then the documents will also be disposed at that point and should not be used thereafter. [% USE dom = XML.DOM %] [% doc = dom.parse('/tmp/myfile') %] [% dom = 'new value' %] # releases XML.DOM plugin and calls # dispose() on 'doc', so don't use it! The plugin constructor will also accept configuration options destined for the XML::Parser object: [% USE dom = XML.DOM(ProtocolEncoding = 'ISO-8859-1') %] METHODS
parse() The parse() method accepts a positional parameter which contains a filename or XML string. It is assumed to be a filename unless it con- tains a < character. [% xmlfile = '/tmp/foo.xml' %] [% doc = dom.parse(xmlfile) %] [% xmltext = BLOCK %] <xml> <blah><etc/></blah> ... </xml> [% END %] [% doc = dom.parse(xmltext) %] The named parameters 'file' (or 'filename') and 'text' (or 'xml') can also be used: [% doc = dom.parse(file = xmlfile) %] [% doc = dom.parse(text = xmltext) %] The parse() method returns an instance of the XML::DOM::Document object representing the parsed document in DOM form. You can then call any XML::DOM methods on the document node and other nodes that its methods may return. See XML::DOM for full details. [% FOREACH node = doc.getElementsByTagName('CODEBASE') %] * [% node.getAttribute('href') %] [% END %] This plugin also provides an AUTOLOAD method for XML::DOM::Node which calls getAttribute() for any undefined methods. Thus, you can use the short form of [% node.attrib %] in place of [% node.getAttribute('attrib') %] PRESENTING DOM NODES USING VIEWS
You can define a VIEW to present all or part of a DOM tree by automatically mapping elements onto templates. Consider a source document like the following: <report> <section title="Introduction"> <p> Blah blah. <ul> <li>Item 1</li> <li>item 2</li> </ul> </p> </section> <section title="The Gory Details"> ... </section> </report> We can load it up via the XML::DOM plugin and fetch the node for the <report> element. [% USE dom = XML.DOM; doc = dom.parse(file = filename); report = doc.getElementsByTagName('report') %] We can then define a VIEW as follows to present this document fragment in a particular way. The Template::Manual::Views documentation con- tains further details on the VIEW directive and various configuration options it supports. [% VIEW report_view notfound='xmlstring' %] # handler block for a <report>...</report> element [% BLOCK report %] [% item.content(view) %] [% END %] # handler block for a <section title="...">...</section> element [% BLOCK section %] <h1>[% item.title %]</h1> [% item.content(view) %] [% END %] # default template block converts item to string representation [% BLOCK xmlstring; item.toString; END %] # block to generate simple text [% BLOCK text; item; END %] [% END %] Each BLOCK defined within the VIEW represents a presentation style for a particular element or elements. The current node is available via the 'item' variable. Elements that contain other content can generate it according to the current view by calling [% item.content(view) %]. Elements that don't have a specific template defined are mapped to the 'xmlstring' template via the 'notfound' parameter specified in the VIEW header. This replicates the node as an XML string, effectively allowing general XML/XHTML markup to be passed through unmodified. To present the report node via the view, we simply call: [% report_view.print(report) %] The output from the above example would look something like this: <h1>Introduction</h1> <p> Blah blah. <ul> <li>Item 1</li> <li>item 2</li> </ul> </p> <h1>The Gory Details</h1> ... To print just the content of the report node (i.e. don't process the 'report' template for the report node), you can call: [% report.content(report_view) %] AUTHORS
This plugin module was written by Andy Wardley and Simon Matthews. The XML::DOM module is by Enno Derksen and Clark Cooper. It extends the the XML::Parser module, also by Clark Cooper which itself is built on James Clark's expat library. COPYRIGHT
Copyright (C) 2000-2006 Andy Wardley, Simon Matthews. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Template::Plugin, XML::DOM, XML::Parser perl v5.8.8 2008-03-01 Template::Plugin::XML::DOM(3pm)
All times are GMT -4. The time now is 10:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy