11-24-2009
Need help in comparing a file with log file: perl code
Dear Members,
I need a perl code:
1. Which will open first file with two columns separated by tab:
37 Distribution and seasonal variation of trace metals
85 Seasonal variability of the mixed layer in the central Bay
99 Dynamics of transparent exopolymeric particles (TEP)
103 Bacterial extracellular polymeric substances (EPS): A carrier
2. Then open web server log files from a folder as per the first column of each line from the first file (such as 37.txt or 85.txt or 99.txt 103.txt etc).
3. Then take the words separated by space (except a, an, the, of, and, etc) from the 2nd column of respective line of first file and count the words, count1++
4. Match the words from $line first files in the 2nd file (log file) each $line. For each word match in each $line of 2nd file, do count2++
5. The required out put file format is
first column (IP) of 2nd file (i.e. log file) tab(\t) count2++ tab(\t) value of count2++/count1++
Extracted Log hits in a file 103.txt as follows:
59.144.4.65 - - [05/Aug/2006:11:53:23 +0530] "GET /drs/bitstream/2264/103/3/Environ_Int_32_191.pdf HTTP/1.1" 200 383974 "http://www.google.co.in/search?q=bioremediation+of+heavy+metals&hl=en&lr=&start=110&sa=N" "Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7"
200.27.127.33 - - [08/Aug/2006:03:08:51 +0530] "GET /drs/bitstream/2264/103/3/Environ_Int_32_191.pdf HTTP/1.1" 200 383974 "http://www.google.cl/search?hl=es&q=concentration+EPS+bacteria&meta=" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"
Thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I need to extract the date part from the file name (20080221 in this ex) and compare it with the current date and delete it, if it is a past date.
$file = exp_ABCD4_T-2584780_upto_20080221.dmp.Z
really appreciate any help.
thanks
mkneni (4 Replies)
Discussion started by: MKNENI
4 Replies
2. Shell Programming and Scripting
Help needed...
Can you tell me how to compare the last two couple entries in a file and print their result in new file..:confused:
I have one file
Check1.txt
\abc1 12345
\abc2 12327
\abc1 12345
\abc2 12330
I want to compare the entries in Check1 and write to... (1 Reply)
Discussion started by: kichu
1 Replies
3. Shell Programming and Scripting
How can i print the output of a perl script on a unix console and redirect the same in a log file under same directory simultaneously ?
Like in Shell script, we use tee, is there anything in Perl or any other option ? (2 Replies)
Discussion started by: butterfly20
2 Replies
4. Shell Programming and Scripting
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
5. Programming
Hi,
plz see the below code , i have catch the file "Orders.20110714.out "file
as a Orders*.out. but it giving me an error .it does not open the file.
if the same thing i have done by code
code-> ls Orders*.out then it gives me the output
Orders.20110714.out
i am trying apply the... (1 Reply)
Discussion started by: pspriyanka
1 Replies
6. Shell Programming and Scripting
Hi,
I have two files with below data::
file1:-
123|aaa|ppp
445|fff|yyy
999|ttt|jjj
555|hhh|hhh
file2:-
445|fff|yyy
555|hhh|hhh
The records present in file1, not present in file 2 should be writtent to the out put file.
output:-
123|aaa|ppp
999|ttt|jjj
Is there any one line... (3 Replies)
Discussion started by: gani_85
3 Replies
7. Shell Programming and Scripting
Hi Guy’s,
I have this simple PERL code which checks whether the file exists . At the moment I am getting the following error
This is the code I am using
#!/usr/bin/perl
Open (F, "home/work/PerlWork/dataFile") or die "Could not open the file:$!\";
Also how can I read the content of... (3 Replies)
Discussion started by: INHF
3 Replies
8. Shell Programming and Scripting
Hi all,
I have one file with IDs
Q8NDM7
P0C1S8
Q8TF30
Q9BRP8
O00258
Q6AWC2
Q9ULE0
Q702N8
A4UGR9
Q13426
Q6P2D8
Q9ULM3
A8MXQ7
I want to compare ID file with another file which has complete information about these IDs and also about other IDs which are not in the above ID file. As... (10 Replies)
Discussion started by: kaav06
10 Replies
9. Shell Programming and Scripting
Hello all,
I need to write a script which has following requirement:
Need to read the filenames from text file and then search for the above read files in the required directory and if match found backup them in a backup folder.
And also need to compare and verify whether the files in the... (7 Replies)
Discussion started by: saurau
7 Replies
10. Shell Programming and Scripting
Hi everyone
I have a question for you, as I am trying to learn more about Perl and work with some weather data. I have an ascii file (shown below) that has 10 lines with different columns. What I would like is have Perl find an "anomalous" value by comparing a field with the values from the last... (2 Replies)
Discussion started by: lucshi09
2 Replies
LEARN ABOUT SUSE
image::exiftool::quicktime
Image::ExifTool::QuickTime(3) User Contributed Perl Documentation Image::ExifTool::QuickTime(3)
NAME
Image::ExifTool::QuickTime - Read QuickTime and MP4 meta information
SYNOPSIS
This module is used by Image::ExifTool
DESCRIPTION
This module contains routines required by Image::ExifTool to extract information from QuickTime and MP4 video, and M4A audio files.
AUTHOR
Copyright 2003-2010, Phil Harvey (phil at owl.phy.queensu.ca)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
REFERENCES
<http://developer.apple.com/documentation/QuickTime/>
http://search.cpan.org/dist/MP4-Info-1.04/ <http://search.cpan.org/dist/MP4-Info-1.04/>
http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt <http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt>
<http://wiki.multimedia.cx/index.php?title=Apple_QuickTime>
http://atomicparsley.sourceforge.net/mpeg-4files.html <http://atomicparsley.sourceforge.net/mpeg-4files.html>
<http://wiki.multimedia.cx/index.php?title=QuickTime_container>
<http://code.google.com/p/mp4v2/wiki/iTunesMetadata>
<http://www.canieti.com.mx/assets/files/1011/IEC_100_1384_DC.pdf>
SEE ALSO
"QuickTime Tags" in Image::ExifTool::TagNames, Image::ExifTool(3pm)
perl v5.12.1 2010-03-09 Image::ExifTool::QuickTime(3)