Sponsored Content
Top Forums Shell Programming and Scripting Logfile - extracting certain lines to concatenate into 1 line Post 302302368 by BecTech on Monday 30th of March 2009 07:28:20 PM
Old 03-30-2009
ok, thanks for the good ideas.. after some hacking and testing I finally got the output in a workable format using awk.

I've outputted the results to an ascii file in a comma delimited format..
my output file is called tstres.txt
and typical lines in the file look like this:

TSTR01 , Mar 29 21:29:17 EDT 2009 , PASS: , Power Check
TSTR01 , Mar 30 00:54:55 EDT 2009 , PASS: , Power Check
TSTR01 , Mar 30 08:31:31 EDT 2009 , **FAIL: , Power Check
TSTR02 , Mar 07 14:41:08 EST 2009 , PASS: , Power Check
TSTR02 , Mar 07 21:46:33 EST 2009 , PASS: , Power Check

What is the easiest way to take this data file and output it to an html table ?

My plan is to have the script run in a cron job and all I'll need to do is view the html page.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extracting Logfile Entries

Hello All, I am trying to write a KSH script that would extract lines from a logfile, within a certain timeframe, in reverse order. Ex. -Sample logfile- INFO 2006-07-12 00:23:00 - ModeDecision Time in WF:27 INFO 2006-07-12 00:24:00 - NRT_MQ_RES:108 INFO 2006-07-12 00:25:00 - getRecords()... (2 Replies)
Discussion started by: harpdl
2 Replies

2. UNIX for Advanced & Expert Users

Need solution concatenate and display 2 lines as 1 with a condition for 2 line ?

I have 2 pattern of lines (SQL query and Time taken)in a log i need to capture all SQL queries with time taken >20 sec and need to display as one line. 2 lines from log: 2007-10-23 11:39:17,061 DEBUG - SQL Query : SELECT A.GROUP_CD , C.FN_CD FROM UP_GROUP A , PRD_GROUP_TO_FN B , PRD_FN... (1 Reply)
Discussion started by: vithala
1 Replies

3. Shell Programming and Scripting

concatenate and display 2 lines as 1 with a condition for 2 line ?

I have 2 pattern of lines (SQL query and Time taken)in a log i need to capture all SQL queries with time taken >20 sec and need to display as one line. 2 lines from log: 2007-10-23 11:39:17,061 DEBUG - SQL Query : SELECT A.GROUP_CD , C.FN_CD FROM UP_GROUP A , PRD_GROUP_TO_FN B , PRD_FN... (7 Replies)
Discussion started by: vithala
7 Replies

4. UNIX for Advanced & Expert Users

need to concatenate two lines if the line doesnt end with quotes

Hi I am getting a source file where the columns are seperated by comma and double Quotes Eg1 : "AAA","BBB","CCCC" in the same source file i am also getting few lines where my last columns double quotes are ending in its next line or the next next line Eg2: "AAA","BBB","CCC CC"... (9 Replies)
Discussion started by: laxmi131
9 Replies

5. Shell Programming and Scripting

sed / awk to concatenate lines until blank line

Sample input (line feed indicated by ) --------------- The red fox jumped over the brown fence of the red hous He then went into the orchard --------------- Desired Output --------------- The red fox jumped over the brown fence of the red house He then went into the orchard (11 Replies)
Discussion started by: dunstonrocks
11 Replies

6. Shell Programming and Scripting

Extracting line matching a phrase and then the next lines after it

Hi all, I was wondering if someone could tell me a way to extract from a file lines where you search for a phrase and then also extract the next X lines after it (i.e. take a block of text from the file)? Example { id=123 time=10:00:00 date=12/12/09 { ........ ... (6 Replies)
Discussion started by: muay_tb
6 Replies

7. Shell Programming and Scripting

extracting data froma logfile

You are given a 1 year logfile with each line starting with a date in the form “YYYY-MM-DD”. How would you extract logs from the 4th day of each month and put them into a new file (3 Replies)
Discussion started by: DOkuwa
3 Replies

8. Shell Programming and Scripting

Extracting lines after nth LINE from an output

Hi all, Here is my problem for which i am breaking my head for past three days.. I have parted command output as follows.. Model: ATA WDC WD5000AAKS-0 (scsi) Disk /dev/sdb: 500GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type ... (3 Replies)
Discussion started by: selvarajvs
3 Replies

9. UNIX for Dummies Questions & Answers

Extracting the two lines where the first line is matched

Hi, If I have a file of something like @hg19_gold_AL122127.6-131160 GCTTCATCATGCATGGATAGGCTGGCGCCTTTCCTGAGGCCATATGCCGATGGATATG @hg19_gold_AL122127.6-131159 CTTTAATATTTCCGCCACCATCCTGAGTGAATCCCAGCAAGGACAGTCTTTGGGGATT @hg19_gold_AL122127.6-131158... (4 Replies)
Discussion started by: jyu429
4 Replies

10. UNIX for Beginners Questions & Answers

Search for word in huge logfile and need to continue to print few lines from that line til find date

Guys i need an idea for one logic..in shell scripting am struggling with a logic...So the thing is... i need to search for a word in a huge log file and i need to continue to print few more lines from that line and the consecutive line has to end when it finds the line with date..because i know... (1 Reply)
Discussion started by: Prathi
1 Replies
Test::XML::XPath(3pm)					User Contributed Perl Documentation				     Test::XML::XPath(3pm)

NAME
Test::XML::XPath - Test XPath assertions SYNOPSIS
use Test::XML::XPath tests => 3; like_xpath( '<foo />', '/foo' ); # PASS like_xpath( '<foo />', '/bar' ); # FAIL unlike_xpath( '<foo />', '/bar' ); # PASS is_xpath( '<foo>bar</foo>', '/foo', 'bar' ); # PASS is_xpath( '<foo>bar</foo>', '/bar', 'foo' ); # FAIL # More interesting examples of xpath assertions. my $xml = '<foo attrib="1"><bish><bosh args="42">pub</bosh></bish></foo>'; # Do testing for attributes. like_xpath( $xml, '/foo[@attrib="1"]' ); # PASS # Find an element anywhere in the document. like_xpath( $xml, '//bosh' ); # PASS # Both. like_xpath( $xml, '//bosh[@args="42"]' ); # PASS DESCRIPTION
This module allows you to assert statements about your XML in the form of XPath statements. You can say that a piece of XML must contain certain tags, with so-and-so attributes, etc. It will try to use any installed XPath module that it knows about. Currently, this means XML::LibXML and XML::XPath, in that order. NB: Normally in XPath processing, the statement occurs from a context node. In the case of like_xpath(), the context node will always be the root node. In practice, this means that these two statements are identical: # Absolute path. like_xpath( '<foo/>', '/foo' ); # Path relative to root. like_xpath( '<foo/>', 'foo' ); It's probably best to use absolute paths everywhere in order to keep things simple. NB: Beware of specifying attributes. Because they use an @-sign, perl will complain about trying to interpolate arrays if you don't escape them or use single quotes. FUNCTIONS
like_xpath ( XML, XPATH [, NAME ] ) Assert that XML (a string containing XML) matches the statement XPATH. NAME is the name of the test. Returns true or false depending upon test success. unlike_xpath ( XML, XPATH [, NAME ] ) This is the reverse of like_xpath(). The test will only pass if XPATH does not generates any matches in XML. Returns true or false depending upon test success. is_xpath ( XML, XPATH, EXPECTED [, NAME ] ) Evaluates XPATH against XML, and pass the test if the is EXPECTED. Uses findvalue() internally. Returns true or false depending upon test success. set_xpath_processor ( CLASS ) Set the class name of the XPath processor used. It is up to you to ensure that this class is loaded. In all cases, XML must be well formed, or the test will fail. SEE ALSO
Test::XML. XML::XPath, which is the basis for this module. If you are not conversant with XPath, there are many tutorials available on the web. Google will point you at them. The first one that I saw was: <http://www.zvon.org/xxl/XPathTutorial/>, which appears to offer interactive XPath as well as the tutorials. AUTHOR
Dominic Mitchell <cpan2 (at) semantico.com> COPYRIGHT AND LICENSE
Copyright 2002 by semantico This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2009-07-02 Test::XML::XPath(3pm)
All times are GMT -4. The time now is 01:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy