Sponsored Content
Full Discussion: Need expertise on awk
Top Forums Shell Programming and Scripting Need expertise on awk Post 302554760 by cwiggler on Tuesday 13th of September 2011 02:30:37 AM
Old 09-13-2011
Need expertise on awk

Hi everyone. I need some help on how to fix this.

I am getting positive result using the log file below and this command
Code:
awk -v t="06:10:22.211" -F'|' -v main=" RBL: " -v trig="BIOS-INFO" '$2 ~ t && $7 ~ main { first = $0; getline; } first && $7 ~ trig { printf "%s\n", first; exit }' log

Code:
|06:10:22.211| mymachine |2|     | kernel :|            RBL: RBL Code 10
|06:10:22.211| mymachine |1|     | kernel :|            DRPD: DRPD 789123
|06:10:22.211| mymachine |2|     | kernel :|            RTR: RTR Incomplete
|06:10:22.211| mymachine |2|     | kernel :|RunThread() - This is it BIOS-INFOXXX : Alert, get info on the upper part.


but with this log im getting negative results.

Code:
|06:10:22.201| mymachine |2|     | kernel :|            RBL: RBL Code 10
|06:10:22.201| mymachine |1|     | kernel :|            DRPD: DRPD 789123
|06:10:22.201| mymachine |2|     | kernel :|            RTR: RTR Incomplete
|06:10:22.211| mymachine |2|     | kernel :|RunThread() - This is it BIOS-INFOXXX : Alert, get info on the upper part.

How can i fix the script to match the timestamp "06:10:22.211" first then get the trigger value even though the timestamp different?

thanks in advance.

Last edited by zaxxon; 09-13-2011 at 04:49 AM.. Reason: added code tags for the line of code
 

10 More Discussions You Might Find Interesting

1. Solaris

x11vnc & tightvnc Expertise Required !

Hi all, For the past 3 days I have been struggling like :mad: to setup a VNC system between a solaris 8 unix host server and a windows XP tightvnc client viewer. Please bear in mind that the unix machine is crap & probably should be taken to the "Antiques Road Show on the BBC". Everything is... (2 Replies)
Discussion started by: fawqati
2 Replies

2. Shell Programming and Scripting

Awk problem: How to express the single quote(') by using awk print function

Actually I got a list of file end with *.txt I want to use the same command apply to all the *.txt Thus I try to find out the fastest way to write those same command in a script and then want to let them run automatics. For example: I got the file below: file1.txt file2.txt file3.txt... (4 Replies)
Discussion started by: patrick87
4 Replies

3. Shell Programming and Scripting

Regexpr expertise required

Any experts on regular expressions out there, can you help me rationalise this? In this post: - https://www.unix.com/shell-programming-scripting/121977-writing-algorithm-recode-data-points-2.html I use the code: - tmp = $1 ; gsub(/00/, ".") ; $1 = tmp tmp = $1 ;... (2 Replies)
Discussion started by: steadyonabix
2 Replies

4. Shell Programming and Scripting

With expertise in the shell I want to help necessary to resolve project and wish you a happy life

Hello to all of you my friends That your friend's new in this forum and Otnmy you to help me to solve this small-scale project I would be grateful to you too The URL for the file that explains that the project os-lab-Search_projectFall2009.pdf (1 Reply)
Discussion started by: دجحخهعدج
1 Replies

5. UNIX for Dummies Questions & Answers

With expertise in the shell I want to help necessary to resolve project and wish you

Hello to all of you my friends That your friend's new in this forum and Otnmy you to help me to solve this small-scale project I would be grateful to you too The URL for the file that explains that the project (1 Reply)
Discussion started by: دجحخهعدج
1 Replies

6. Shell Programming and Scripting

awk command to compare a file with set of files in a directory using 'awk'

Hi, I have a situation to compare one file, say file1.txt with a set of files in directory.The directory contains more than 100 files. To be more precise, the requirement is to compare the first field of file1.txt with the first field in all the files in the directory.The files in the... (10 Replies)
Discussion started by: anandek
10 Replies

7. Shell Programming and Scripting

HELP with AWK one-liner. Need to employ an If condition inside AWK to check for array variable ?

Hello experts, I'm stuck with this script for three days now. Here's what i need. I need to split a large delimited (,) file into 2 files based on the value present in the last field. Samp: Something.csv bca,adc,asdf,123,12C bca,adc,asdf,123,13C def,adc,asdf,123,12A I need this split... (6 Replies)
Discussion started by: shell_boy23
6 Replies

8. UNIX for Advanced & Expert Users

Expertise advice required <<URGENT>>

:eek:i hav a shell script in my linux server, i want to execute it everyday once automatically without using cron tabs as i dont hav permission to create one. So wht sld i do??:confused: (1 Reply)
Discussion started by: Jay Thakkar
1 Replies

9. Shell Programming and Scripting

Passing awk variable argument to a script which is being called inside awk

consider the script below sh /opt/hqe/hqapi1-client-5.0.0/bin/hqapi.sh alert list --host=localhost --port=7443 --user=hqadmin --password=hqadmin --secure=true >/tmp/alerts.xml awk -F'' '{for(i=1;i<=NF;i++){ if($i=="Alert id") { if(id!="") if(dt!=""){ cmd="sh someScript.sh... (2 Replies)
Discussion started by: vivek d r
2 Replies

10. Shell Programming and Scripting

awk output yields error: awk:can't open job_name (Autosys)

Good evening, Im newbie at unix specially with awk From an scheduler program called Autosys i want to extract some data reading an inputfile that comprises jobs names, then formating the output to columns for example 1. This is the inputfile: $ more MapaRep.txt ds_extra_nikira_usuarios... (18 Replies)
Discussion started by: alexcol
18 Replies
rblsmtpd(1)                                                   General Commands Manual                                                  rblsmtpd(1)

NAME
rblsmtpd - blocks mail from RBL-listed sites. It works with any SMTP server that can run under tcpserver(1) SYNOPSIS
rblsmtpd opts prog DESCRIPTION
opts is a series of getopt-style options. prog consists of one or more arguments. Normally rblsmtpd runs prog. prog is expected to carry out an SMTP conversation to receive incoming mail messages. However, rblsmtpd does not invoke prog if it is told to block mail from this client. Instead it carries out its own limited SMTP conversa- tion, temporarily rejecting all attempts to send a message. Meanwhile it prints one line on descriptor 2 to log its activity. rblsmtpd drops the limited SMTP conversation after 60 seconds, even if the client has not quit by then. OPTIONS
-t n Change the timeout to n seconds. Blocked clients If the $RBLSMTPD environment variable is set and is nonempty, rblsmtpd blocks mail. It uses $RBLSMTPD as an error message for the client. Normally rblsmtpd runs under tcpserver(1); you can use tcprules(1) to set $RBLSMTPD for selected clients. If $RBLSMTPD is set and is empty, rblsmtpd does not block mail. If $RBLSMTPD is not set, rblsmtpd looks up $TCPREMOTEIP in the RBL, and blocks mail if $TCPREMOTEIP is listed. tcpserver sets up $TCPRE- MOTEIP as the IP address of the remote host. -r base Use base as an RBL source. An IP address a.b.c.d is listed by that source if d.c.b.a.base has a TXT record. rblsmtpd uses the con- tents of the TXT record as an error message for the client. -a base Use base as an anti-RBL source. An IP address a.b.c.d is anti-listed by that source if d.c.b.a.base has an A record. In this case rblsmtpd does not block mail. You may supply any number of -r and -a options. rblsmtpd tries each source in turn until it finds one that lists or anti-lists $TCPRE- MOTEIP. It also tries an RBL source of rbl.maps.vix.com if you do not supply any -r options. See http://maps.vix.com/rbl/ for more informa- tion about rbl.maps.vix.com. If you want to run your own RBL source or anti-RBL source for rblsmtpd, you can use rbldns from the DNScache (djbdns) package. Temporary errors Normally, if $RBLSMTPD is set, rblsmtpd uses a 451 error code in its limited SMTP conversation. This tells legitimate clients to try again later. It gives innocent relay operators a chance to see the problem, prohibit relaying, get off the RBL, and get the mail delivered. However, if $RBLSMTPD begins with a hyphen, rblsmtpd removes the hyphen and uses a 553 error code. This tells legitimate clients to bounce the message immediately. There are several error-handling options for RBL lookups: -B (Default.) Use a 451 error code for IP addresses listed in the RBL. -b Use a 553 error code for IP addresses listed in the RBL. -C (Default.) Handle RBL lookups in a ``fail-open'' mode. If an RBL lookup fails temporarily, assume that the address is not listed; if an anti-RBL lookup fails temporarily, assume that the address is anti-listed. Unfortunately, a knowledgeable attacker can force an RBL lookup or an anti-RBL lookup to fail temporarily, so that his mail is not blocked. -c Handle RBL lookups in a ``fail-closed'' mode. If an RBL lookup fails temporarily, assume that the address is listed (but use a 451 error code even with -b). If an anti-RBL lookup fails temporarily, assume that the address is not anti-listed (but use a 451 error code even if a subsequent RBL lookup succeeds with -b). Unfortunately, this sometimes delays legitimate mail. SEE ALSO
tcpserver(1), tcprules(1), tcprulescheck(1), fixcrio(1), recordio(1), rblsmtpd(1), tcpclient(1), who@(1), date@(1), finger@(1), http@(1), tcpcat(1), mconnect(1), tcp-environ(5) http://cr.yp.to/ucspi-tcp.html rblsmtpd(1)
All times are GMT -4. The time now is 07:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy