Sponsored Content
Top Forums Shell Programming and Scripting Generating formatted reports from log files Post 302338408 by summer_cherry on Monday 27th of July 2009 11:19:46 PM
Old 07-28-2009
perl:


Code:
while(<DATA>){
	chomp;
	next if $. == 1;
  my @tmp=split("[ |]",$_);
  push @{$hash{$tmp[1]}}, $tmp[0]." ".$tmp[5];
}
foreach my $key(keys %hash){
	print "ID = $key\n";
	print join "\n", @{$hash{$key}};
	print "\n";
}
__DATA__
DATE ID LOG_LEVEL | EVENT
2009-07-23T14:05:11Z T-4030097550 D | MessX
2009-07-23T14:10:44Z T-4030097550 D | MessY
2009-07-23T14:34:08Z T-7298651656 D | MessX
2009-07-23T14:41:00Z T-7298651656 D | MessY
2009-07-23T15:05:10Z T-4030097550 D | MessZ

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Generating a report -Formatted printing -Urgent

Hi, My aim is to generate a report using shell script. There are various formats fields coloumns etc. I want to print in a single line (row) but in different coloumn as given below: field1 field2 field3 field4 ....... ....... ...... ....... The spacing... (1 Reply)
Discussion started by: jisha
1 Replies

2. Shell Programming and Scripting

generating reports based on time field of network data

hi i have data extracted in the following format ranging around 300000 to 800000 records in a text file , the format is of network data . No. Time Source Destination Protocol 1 1998-06-05 17:20:23.569905 HP_61:aa:c9 HP_61:aa:c9 ... (1 Reply)
Discussion started by: renukaprasadb
1 Replies

3. Shell Programming and Scripting

Generating files.

I/P file name:- 20092008.txt Check number of entries in i/p file by following command ChkEnt -infl 20092008.txt -opfl 20092008_test.txt >count.txt Dear Friends, Please help me in automating following thing. If output generated (count.txt) is having value more than 1000 i.e.... (8 Replies)
Discussion started by: anushree.a
8 Replies

4. Shell Programming and Scripting

how to search reports with specified keyword in log

Hi, I have a question with sed/awk. When I handle some log files I want to search all reports with specified keyword. For example, in the log below. abcd efg ===start abc e ===end xyz ===start af f ===end nf ga ===start ab ===end (4 Replies)
Discussion started by: danielnpu
4 Replies

5. Red Hat

sarg issue while generating reports for squid

I installed sarg from sarg rpm and i am facing issue while generating sarg reports and getting this time different error below sarg -l /var/log/squid/access.log SARG: Records in file: 242332, reading: 0.00% SARG: Records in file: 242332, reading: 2.06% SARG: Records in file: 242332, reading:... (0 Replies)
Discussion started by: mail4vij
0 Replies

6. Shell Programming and Scripting

Extract information from Log file formatted

Good evening! Trying to make a shell script to parse log file and show only required information. log file has 44 fields and alot of lines, each columns separated by ":". log file is like: first_1:3:4:5:6:1:3:4:5:something:notinterested second_2:3:4:3:4:2 first_1:3:4:6:6:7:8 I am interested... (3 Replies)
Discussion started by: dummie55
3 Replies

7. Linux

Generating apache log reports

Hello all, I'm trying to find some tool on generating reports based on apache access_log files (of Common format). I found some of them (awstats, lire/logreport, weblog expert, apache logs viewer, etc..) but they generate some global and general report about the log file. Also some perl... (0 Replies)
Discussion started by: enux
0 Replies

8. Shell Programming and Scripting

Generate a Execution time reports using log files.

Hi Experts, I am having a requirement, where i need to generate a report of the execution time of all the processes. All the processes generate the log files in a log directory and I can get the execution time from the log files. like below is the log file. /home/vikas/log >ls -l... (2 Replies)
Discussion started by: k_vikash
2 Replies

9. Shell Programming and Scripting

Split files with formatted numbers

How to split the file and have suffix with formatted numbers Tried the following code awk '{filename="split."int((NR-1)/2)".txt"; print >> filename}' split.txt Current Result Expected Result (21 Replies)
Discussion started by: bobbygsk
21 Replies

10. UNIX for Beginners Questions & Answers

Cron job scheduled is running once, but reports are generating twice

Team, Hope you all are doing fine I have one admin server which is being used dedicately to run cron jobs on hourly basis, fetching the details from Database which is in a different server.These cronjob are run on every hourly/5 minutes basis depending as per end user requirement.The script... (12 Replies)
Discussion started by: whizkidash
12 Replies
Header(3pm)						User Contributed Perl Documentation					       Header(3pm)

NAME
Audio::FLAC::Header - interface to FLAC header metadata. SYNOPSIS
use Audio::FLAC::Header; my $flac = Audio::FLAC::Header->new("song.flac"); my $info = $flac->info(); foreach (keys %$info) { print "$_: $info->{$_} "; } my $tags = $flac->tags(); foreach (keys %$tags) { print "$_: $tags->{$_} "; } DESCRIPTION
This module returns a hash containing basic information about a FLAC file, a representation of the embedded cue sheet if one exists, as well as tag information contained in the FLAC file's Vorbis tags. There is no complete list of tag keys for Vorbis tags, as they can be defined by the user; the basic set of tags used for FLAC files include: ALBUM ARTIST TITLE DATE GENRE TRACKNUMBER COMMENT The information returned by Audio::FLAC::info is keyed by: MINIMUMBLOCKSIZE MAXIMUMBLOCKSIZE MINIMUMFRAMESIZE MAXIMUMFRAMESIZE TOTALSAMPLES SAMPLERATE NUMCHANNELS BITSPERSAMPLE MD5CHECKSUM Information stored in the main hash that relates to the file itself or is calculated from some of the information fields is keyed by: trackLengthMinutes : minutes field of track length trackLengthSeconds : seconds field of track length trackLengthFrames : frames field of track length (base 75) trackTotalLengthSeconds : total length of track in fractional seconds bitRate : average bits per second of file fileSize : file size, in bytes CONSTRUCTORS
"new ($filename)" Opens a FLAC file, ensuring that it exists and is actually an FLAC stream, then loads the information and comment fields. INSTANCE METHODS
o info( [$key] ) Returns a hashref containing information about the FLAC file from the file's information header. The optional parameter, key, allows you to retrieve a single value from the info hash. Returns "undef" if the key is not found. o tags( [$key] ) Returns a hashref containing tag keys and values of the FLAC file from the file's Vorbis Comment header. The optional parameter, key, allows you to retrieve a single value from the tag hash. Returns "undef" if the key is not found. o cuesheet( ) Returns an arrayref which contains a textual representation of the cuesheet metada block. Each element in the array corresponds to one line in a .cue file. If there is no cuesheet block in this FLAC file the array will be empty. The resulting cuesheet should match the output of metaflac's --export-cuesheet-to option, with the exception of the FILE line, which includes the actual file name instead of "dummy.wav". o seektable( ) Returns the seektable. Currently disabled for performance. o application( $appId ) Returns the application block for the passed id. o picture( [$type ] ) Returns a hash containing data from a PICTURE block if found. Defaults to type 3 - "Front Cover" When the passed variable is 'all', an array of hashes containing picture data from all PICTURE blocks is returned. Allows for multiple instances of the same picture type. o set_separator( ) For multi-value ID3 tags, set the separator string. Defaults to '/' o vendor_string( ) Returns the vendor string. o set_vendor_string( $string ) Set the vendor string. Will be written on write() o write( ) Writes the current contents of the tag hash to the FLAC file, given that there's enough space in the header to do so. If there's insufficient space available (using pre-existing padding), the file will remain unchanged, and the function will return a zero value. SEE ALSO
<http://flac.sourceforge.net/format.html> AUTHORS
Dan Sully, <daniel@cpan.org> COPYRIGHT
Pure perl code Copyright (c) 2003-2004, Erik Reckase. Pure perl code Copyright (c) 2003-2007, Dan Sully & Slim Devices. Pure perl code Copyright (c) 2008-2009, Dan Sully XS code Copyright (c) 2004-2007, Dan Sully & Slim Devices. XS code Copyright (c) 2008-2009, Dan Sully This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available. perl v5.14.2 2009-08-20 Header(3pm)
All times are GMT -4. The time now is 06:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy