Sponsored Content
Top Forums Shell Programming and Scripting [Perl] Same entries in file, but treat them different. Post 302521660 by ejdv on Thursday 12th of May 2011 02:19:17 AM
Old 05-12-2011
Thanks.
I always envy persons that can produce a one-liner for something where I need a full page.

Quote:
Originally Posted by mirni
What exactly is your problem?
My problem is that the line with "Starting Table table loading" appears 3 times and that always the last entry is taken for calculation.
So I got 3 times the same start time for 3 different events.

And the problem with this example is that I took out some lines for simplicity.
But you got my intentions right.

What if the log.out file is something like this:

Quote:
table_load,1304943291,Mon May 9 12:14:51 GMT 2011,STATUS: Blah blah blah.
table_load,1304943291,Mon May 9 12:14:51 GMT 2011,STATUS: Sorting of Table data file started.
table_load,1304943291,Mon May 9 12:14:51 GMT 2011,STATUS: Blah blah blah.
table_load,1304943291,Mon May 9 12:14:51 GMT 2011,STATUS: Blah blah blah.
table_load,1304943750,Mon May 9 12:22:30 GMT 2011,STATUS: Starting Table table loading.
table_load,1304943291,Mon May 9 12:14:51 GMT 2011,STATUS: Blah blah blah.
table_load,1304943291,Mon May 9 12:14:51 GMT 2011,STATUS: Blah blah blah.
table_load,1304943291,Mon May 9 12:14:51 GMT 2011,STATUS: Blah blah blah.
table_load,1304947100,Mon May 9 13:18:20 GMT 2011,STATUS: Sorting of Table1 data file started.
table_load,1304943291,Mon May 9 12:14:51 GMT 2011,STATUS: Blah blah blah.
table_load,1304947546,Mon May 9 13:25:46 GMT 2011,STATUS: Starting Table table loading.
table_load,1304943291,Mon May 9 12:14:51 GMT 2011,STATUS: Blah blah blah.
table_load,1304943291,Mon May 9 12:14:51 GMT 2011,STATUS: Blah blah blah.
table_load,1304950974,Mon May 9 14:22:54 GMT 2011,STATUS: Sorting of Table2 data file started.
table_load,1304943291,Mon May 9 12:14:51 GMT 2011,STATUS: Blah blah blah.
table_load,1304943291,Mon May 9 12:14:51 GMT 2011,STATUS: Blah blah blah.
table_load,1304943291,Mon May 9 12:14:51 GMT 2011,STATUS: Blah blah blah.
table_load,1304951297,Mon May 9 14:28:17 GMT 2011,STATUS: Starting Table table loading.
table_load,1304943291,Mon May 9 12:14:51 GMT 2011,STATUS: Blah blah blah.
table_load,1304954040,Mon May 9 15:14:00 GMT 2011,STATUS: Creating Table indexes.
table_load,1304943291,Mon May 9 12:14:51 GMT 2011,STATUS: Blah blah blah.
table_load,1304943291,Mon May 9 12:14:51 GMT 2011,STATUS: Blah blah blah.
table_load,1304956993,Mon May 9 16:03:13 GMT 2011,STATUS: Analyzing table Table.
table_load,1304943291,Mon May 9 12:14:51 GMT 2011,STATUS: Blah blah blah.
table_load,1304957476,Mon May 9 16:11:16 GMT 2011,STATUS: End of table_load.
Probably I need to write the lines I need to an array and use your code.
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk - treat multiple delimiters as one

Is there anyway to get awk to treat multiple delimiters as one? Particularly spaces... (6 Replies)
Discussion started by: peter.herlihy
6 Replies

2. Shell Programming and Scripting

How to get the difference between dates?Can i treat as string?

Hi All , I have an output value with two columns like this... Days User 10 A 500 B 1 C How i can compare the first column value and passing the user name as parameter? For example : while read -r days If (days<=30) ; then value=days/30 x100 ... (3 Replies)
Discussion started by: EDBGSK
3 Replies

3. Shell Programming and Scripting

while read loop w/ a nested if statement - doesn't treat each entry individually

Hi - Trying to take a list of ldap suffixes in a file, run an ldapsearch command on them, then run a grep command to see if it's a match, if not, then flag that and send an email alert. The list file (ldaplist) would look like - *********** o=company a o=company b *********** **... (7 Replies)
Discussion started by: littlefrog
7 Replies

4. UNIX for Dummies Questions & Answers

make script treat * as a regular character

I need a script that reads the out put of a command (softwareupdate --list) and will tally up the number of asterisks in the output and tell me how many there were. How do I go about getting my script to treat asterisks as a regular character and not a wildcard or some other operator? (8 Replies)
Discussion started by: glev2005
8 Replies

5. UNIX for Dummies Questions & Answers

doubt to treat plaintext script

Hi everyone! first of all thank you all for the forum. My question is, is there a bash or java program, which addresses the existing text in the html that is visible in the web page for editing by another string, eg name1: flakjsdlñfjas Name of father: fdfjaksdfjskdfsd Well it... (1 Reply)
Discussion started by: xavilito
1 Replies

6. 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

7. Shell Programming and Scripting

awk script modification - treat certain files differently

awk 'BEGIN{OFS=","} FNR == 1 {if (NR > 1) {print fn,fnr,nl} fn=FILENAME; fnr = 1; nl = 0} {fnr = FNR} /UNUSUAL/ && /\.gz/ ~ /FILENAME/ {nl++} <'{system ("gunzip -cd FILENAME")}' END ... (2 Replies)
Discussion started by: SkySmart
2 Replies

8. Shell Programming and Scripting

Treat Command Output as a File

Hi. Before I've post this question, I have spent hours looking for the solutions but to no avail. Because I think it is possible but I just don't know what is the right keyword to search for. Ok, basically what I want to achieve is really simple. It's just that I don't want to write... (20 Replies)
Discussion started by: aimy
20 Replies
CYR_EXPIRE(8)						      System Manager's Manual						     CYR_EXPIRE(8)

 *

NAME
cyr_expire - expire messages and duplicate delivery database entries SYNOPSIS
cyr_expire [ -C config-file ] [ -D delete-days ] -E expire-duration [ -X expunge-days ] [ -p mailbox-prefix ] [ -v ] DESCRIPTION
Cyr_expire is used to expire messages and duplicate delivery database entries. Cyr_expire also cleanses mailboxes of partially expunged messages (when using the "delayed" expunge mode). The expiration of messages is controlled by the /vendor/cmu/cyrus-imapd/expire mailbox annotation which specifies the age (in days) of messages in the given mailbox that should be deleted. Any duplicate delivery database entries which correspond to the mailbox are also deleted at the same frequency. The value of the /vendor/cmu/cyrus-imapd/expire annotation is inherited by all children of the given mailbox, so an entire mailbox tree can be expired by seting a single annotation on the root of that tree. If a mailbox does not have a /vendor/cmu/cyrus-imapd/expire annotation set on it (or does not inherit one), then no messages are expired from the mailbox. Cyr_expire reads its configuration options out of the imapd.conf(5) file unless specified otherwise by -C. OPTIONS
-C config-file Read configuration options from config-file. -D delete-duration Remove previously deleted mailboxes older than delete-duration (when using the "delayed" delete mode). The value can be a floating point number, and may have a suffix to specify the unit of time. If no suffix, the value is number of days. Valid suffixes are d (days), h (hours), m (minutes) and s (seconds). -E expire-duration Prune the duplicate database of entries older than expire-duration. This value is only used for entries which do not have a corre- sponding /vendor/cmu/cyrus-imapd/expire mailbox annotation. Format is the same as delete-duration. -X expunge-duration Expunge previously deleted messages older than expunge-duration (when using the "delayed" expunge mode). Format is the same as delete-duration. -x Do not expunge messages even if using delayed expunge mode (reduces the IO hit considerably, allowing you to run cyr_expire fre- quently to clean up the duplicate database without overloading your server) -p mailbox-prefix Only find mailboxes starting with this prefix. e.g. "user.justgotspammedlots" -v Enable verbose output. -a Skip the annotation lookup, so all /vendor/cmu/cyrus-imapd/expire annotations are ignored entirely. It behaves as if they were not set, so only expire-days is considered for all mailboxes. FILES
/etc/imapd.conf SEE ALSO
imapd.conf(5), cyrus-master(8) CMU
Project Cyrus CYR_EXPIRE(8)
All times are GMT -4. The time now is 04:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy