Programming :: Mail Log Parsing Script In Need Of Makeover?
May 30, 2011
I'm working on a script that will parse a mail machine's logs and print a list of email addresses in this format:
authen@domain.com | sender@domain | recipient@domain
exam
account1@domain1.com | sender2@domain2.com |
[code]...
View 2 Replies
ADVERTISEMENT
Aug 31, 2009
I have logs files from freeradius that have looks as follows:
$ grep "Login incorrect (rlm_ldap: User not found" /var/log/radius/radiusd-inner-tunnel-20090831.log
Mon Aug 31 09:25:27 2009 : Auth: Login incorrect (rlm_ldap: User not found): [John Doe] (from client oficina port 0 via TLS tunnel)
[code]....
I use the following line to get the amount of users that don't exist on ldap:
Code:
grep "Login incorrect (rlm_ldap: User not found" /var/log/radius/radiusd-inner-tunnel-20090831.log | awk '{print $14}' | sort -fu | wc -l
Now, awk on line one for example parses [John Doe] and [Joon Williams] as "[John" and that it's not what I'd want. I mean how could I do for awk looks username field as closed between squared brackets?
View 1 Replies
View Related
Sep 14, 2010
Is there a Linux system call that can be used to get the group name from the GID returned by stat()? I realize that I could parse /etc/groups (if my user had sufficient permissions).
View 3 Replies
View Related
Feb 1, 2011
I've been loosely following this:http://norvig.com/lispy.htmlAnd I have a problem: the parsing function throws an array out of bounds exception. I thought that maybe I'm doing it wrong, so I copy and pasted the code from the page, and still the same error
View 2 Replies
View Related
Mar 14, 2009
i wanted to know how can I pars a xml file (read data from xml file) and from C program.is there any function to do this for me in C.
View 1 Replies
View Related
Jul 7, 2011
I'll show the code first:
Code:
What I am after is to get the string text from the clip tags. But for now I just tested to see if it can finds the command tags and print something if it does. But it doesn't find it. Anyone knows why ?
Looks like the xml is not good, i test it with a xml validator:
Code:
View 1 Replies
View Related
Nov 9, 2010
I have a log file (test.log) starting & ending within dash (--) as below. I am looking to write a parser for test.log. This test.log file currently has single value for one Job ID but I wish to parse for repeated N values of different Job ID - Job, User, Queue, Dispatched Date, Dispatched Time, Completed Date, Completed Time, Hosts/Processor, CPU_T and TURNAROUND. I can either output this 10 values in another .log file or dump into cgi.
The selected parameters from test.log for parsing with above 10 attributes are -
--
Job <345010>
User <xyz>
Queue <gaussian>
[code]....
View 3 Replies
View Related
May 11, 2010
Does anyone have source code on Email parsing in C++
View 1 Replies
View Related
Jan 24, 2011
I have a variable in which the data is stored as below:
variable_test=0m0.001s 0m0.001s 0m0.001s 0m0.001s 0m0.001s 0m0.001s .....an so on.
There are lots of values in format like "3m1.057s" are stored in variable_test separated with an space between two such values. For exapmple, value is "3m1.057s" I need to save different parts of a value in three separate array variables such as the
var_hour=3
var_min=1
var_sec= 057
tell if this can be done using "awk". A "WHILE" loop might be used to separate and store theses values I guess?
View 1 Replies
View Related
Feb 1, 2010
I want to know how to get eg. the contents of a form on a webpage which has been passed to a server side PHP script, inside for example an array which I can read. I've been reading a ebook on PHP which as far as I can see doesn't cover this inside it.
View 1 Replies
View Related
Oct 25, 2010
I have spent lots of time trying to figure out how to parse the domain part of this file but am stuck.
How should this be approached:
Code:
Code:
The domains need to be parse at a maximum for 4 levels then the remainder will be put the last field.
View 3 Replies
View Related
Apr 25, 2011
I'm trying to recreate a simple script I wrote to parse out the access.log to get a rough idea of websites that users are going to on our corp network. The issue I'm having is I want to pull out any line from access.log that ends in .com/ .org/ .net/ or whatever to only see what the user entered into the address bar and drop pictures, js's and everything else and log only this. so what I do is :awk '{print $8} | grep -e '[cong]|[ore]|[mgtv][/]'$ and nothing happens.I know there is an easier way to do this with awk alone,
View 8 Replies
View Related
Sep 10, 2010
My C foo is terrible! I am working with some code which reads lines from a file and then reformats the lines and writes them to a new file.The input lines look like this:
Code:
+[NEOTEST?]
+[NEOTEST]
[code]...
View 2 Replies
View Related
Apr 8, 2010
bash script:
Code:
$ bash --version
bash --version
GNU bash, version 3.1.17(2)-release (i486-slackware-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
Code:
[serv:]$ cat test.sh
#!/bin/bash
[Code]...
The question is, how to config it works through 'function cool {}' or cool() {} with position parameter
View 5 Replies
View Related
Aug 28, 2009
language: C
OS: linux
I wrote a multithread program(approx 1000 thread have to run) and each thread has to parse a file(for each thread there is one file, ex:thread1 has to parse file1 and thread2 has to parse file2 like this....). I wrote "parse" program as follows. It is working well, if i create 50 threads. but if i run more than 200 thraeds Im getting doublefree corruption as follows:
Code:
*** glibc detected *** ./simulator: double free or corruption (fasttop): 0xb70007b0 ***
And some time I am getting parsing problem and error af follows:
Code:
powersetting.6607:1: parser error : Start tag expected, '<' not found (where powersetting.6607 is file name, when i check this file it is started with '<').
parse program as follows:
Code:
void parse_first(char* filename, int portnum, struct Poweroff *Powerptr1)
{
struct Poweroff *Powerptr;
Powerptr = Powerptr1;
[code]....
View 1 Replies
View Related
Apr 6, 2010
I've searched online and found many examples using getopts, but nothing that clearly explains it use, nor any examples of what I'm trying to do. I have a script named "process". It can take from 0 to 3 different options. I'd like to be able to handle these options regardless of the order that they are entered.
Syntax:
process [-v] [-d #] [-h|-?] [string]
-v = verbose mode on
-d # = how deep to do the process, expecting a number parameter
-h or -? = show command usage
string = only process lines containing the specified string
[Code]..
View 5 Replies
View Related
Nov 5, 2010
As a curious side project I'm playing with mzXML data(an xml format for holding mass spec data). A typical scan can be quite large, even up into GB size. I'm wondering how would one go about parsing an xml file in sections, one section at a time. The idea being if the computer doesn't have enough memory to load up the entire data file, work on chunks of it at a time.
View 3 Replies
View Related
Aug 11, 2009
Is there a way to process individual characters one-by-one from a text file in Bash, or is that hoping for a little too much from this lovable old clunker?
View 13 Replies
View Related
Jun 1, 2011
Google directed me to the ones written in .Net/C# etc. Any ideas on the ones written in C/C++?
View 14 Replies
View Related
Oct 14, 2010
I have a bash variable where the content looks like this where ;f1; and ;f2; are delimiters:
;f1;field1value1;f2;field2 value1 ;f1;field1value2;f2;field2 value2 ;f1;field1value3;f2;field2 value3
So what I need is to extract and put into variables each combination of f1 and f2 in a loop to something like that:
#first pass of the loop I need:
f1=field1value1
f2=field2 value1
#second pass of the loop I need:
f1=field1value2
f2=field2 value2
# third pass of the loop I need:
f1=field1value3
f2=field2 value3
View 15 Replies
View Related
Jan 4, 2010
I am going to parse the Cisco voip CDR(Call Detail Records), please tell me the field format of the CDR files.
View 1 Replies
View Related
May 29, 2011
PI'm trying to write a script to list all open ports in the MINIUNPND chain in iptables and use the procotol, port and destination ip to open ports on another router using upnpc.Here is the output of iptables -L MINIUPNPD
Code:
>iptables -L MINIUPNPD
Chain MINIUPNPD (1 references)
target prot opt source destination
ACCEPT tcp -- anywhere 192.168.3.124 tcp dpt:19955
ACCEPT tcp -- anywhere 192.168.3.124 tcp dpt:20054
ACCEPT tcp -- anywhere 192.168.3.130 udp dpt:10654
ACCEPT tcp -- anywhere 192.168.3.121 tcp dpt:29955
code....
No matter what i do i cant seem to remove the first 4 characters from the MYPROT array to leave only the digits. Also i cant seem to read the array back???
I thought it would simply be a loop reading each line and passing the fields in variables, executing upnpc commands i need then moving to the next line of the file until it reached the EOF.
View 12 Replies
View Related
Sep 9, 2010
this is my code at the moment
PHP Code: <?php
if (isset($_REQUEST['email'])) && $_REQUEST['email']!='0'{
$to = "chrisathisemail";
[code]....
View 5 Replies
View Related
Nov 30, 2010
Was told that I need to use Javamail for a project to send mail rather than using "mail" or "mailx". Has anyone here done this?Any pointers or sites you've used and can recommend?
View 1 Replies
View Related
Jul 9, 2009
parsing xml file using shell script and generate report in a PDF file
Xml file input:
<report>
<student name="x" father name="x1" class="first" Address="xyz">
<property name="sports" value="yes"/>
<property name="drawing" value="no"/>
[code]....
View 12 Replies
View Related
Feb 28, 2010
My script collects information and writes it to a xls file and should mail it across. I tested the first part of the script which writes the excel file , it does write the excel file fairly with expected data using Spreadsheet::WriteExcel module Second part uses MIME::Lite , All I get is a mail with intended subject intact but without the attachment . Following is the code , I have googled and tried out many options , didn't go any further apart from receiving a mail without attachment.
use MIME::Lite;
$msg = MIME::Lite->new(
From => 'xx',
To => 'xx',
[code]...
I am using RHEL 4 , Perl 5.8
View 5 Replies
View Related
Jul 18, 2011
I am an avid user of gmail. Recently I have been receiving some important e-mails, and I want to download only those e-mails from that specific person to a folder.
View 1 Replies
View Related
Feb 11, 2010
I have specified a particular IP in the php.ini configuration file to be used by the mail() function. However, there are exceptions when I want to use a different SMTP Server's IP to relay delivery of emails to External Domains. So, how to use SMTP Value in the mail() function. I think it has to be done in the Header Section of it...?
View 4 Replies
View Related
Jun 11, 2010
I need to update very old mail files to make them mbox compliant. What I need to do is find all lines beginning with ^To: and put a comma between a random number of names on this To: line. So I want to replace the 2nd and all subsequent <space> on this lines with ,<space>.
It should be something like:
s/^To: [ ]/&,/2g
But that isn't correct.
View 2 Replies
View Related
Feb 16, 2010
Using a shell script....In a particular directory if we are adding one or more files i should get a mail to my mail id , every time when the new file is added i should get the mail.Using crontab so that it will execute automatically wen any new files are added.
View 3 Replies
View Related