Sponsored Content
Top Forums UNIX for Beginners Questions & Answers awk script to find repeated IP adress from trace file (.tr) Post 302992734 by RudiC on Wednesday 1st of March 2017 06:27:16 AM
Old 03-01-2017
In fact, I CAN'T see that 10.1.3.7 is the most repeated pair, nor how and why it should be associated to 8.00747. The most repeated (to me) seems to be 10.1.3.3 > 10.1.2.4, occurring 20 times between 8.00747 and 64.0048. Mayhap you can build on this:

Code:
awk '
        {IX = $29 " > " $31
         sub (/\)/, _, IX)
         CNT[IX]++
         MIN[IX] = $2<MIN[IX] || !MIN[IX]?$2:MIN[IX]
         MAX[IX] = $2>MAX[IX]            ?$2:MAX[IX]
        }
END     {for (c in CNT) printf "%20s %3d %9.5f %9.5f\n", c, CNT[c], MIN[c], MAX[c]
        }
' file
 10.1.3.3 > 10.1.2.4  20   8.00747  64.00480
 10.1.3.7 > 10.1.2.4   1  32.00080  32.00080
 10.1.3.6 > 10.1.2.4   1  24.00080  24.00080
 10.1.3.5 > 10.1.2.4   1  16.00080  16.00080
 10.1.4.5 > 10.1.2.4   1   8.00747   8.00747

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to find a word repeated in a file

Hi everyone, I have a file in which a word is repeated more than one time and I want to know how many times it is repeated. ex: if i repeated word 'guru' in 10 lines I can get the o/p as: cat filename | grep -c 'guru'. How ever if the word is repeated more than one time, then how can I... (4 Replies)
Discussion started by: gurukottur
4 Replies

2. Shell Programming and Scripting

To find the IP adress in the log file

Hi, I need to find out the repeated IP address from the apache log file from my box. I did try to come out with the script, but I could not grep out the repeated Ip Address from the error_logs and need to redirect to a file. Can you guys please help me out of this problem. Thanks in... (9 Replies)
Discussion started by: gsiva
9 Replies

3. Shell Programming and Scripting

To find the repeated name in subject

Hi, I am using a mail application, When I use to check with the command, I will get the outputs as q -s 6128175 (9, 9/6128175) Return-path: minka.bell@abcd.org From: "Minka Bell" <minka.bell@abcd.org> To: <dcrouch@xyz.org>, Subject: Open items with new PICT system Date: Wed,... (12 Replies)
Discussion started by: gsiva
12 Replies

4. Shell Programming and Scripting

Trying to get an IP adress from a file

This is probably a real n00b question but i`m not able to figure it out. I have a folder of configuration files that contain IP-adresses. The line i`m interested in looks like this: IP_ADDRESS="123.123.123.1123" Some have muliple ip adresses, so the line will look like : ... (5 Replies)
Discussion started by: DaneV
5 Replies

5. Shell Programming and Scripting

How to find repeated string in a text file

I have a text file where I need to find the string = ST*850* This string is repetaed several times in the file, so I need to know how many times it appears in the file, this is the text files: ISA*00* *00* *08*925485USNR *ZZ*IMSALADDERSP... (13 Replies)
Discussion started by: cucosss
13 Replies

6. Shell Programming and Scripting

sort file with email adress

Hi All, I have a file which is "|" pipe delimited. The file has 3 fields. the last field contains email ids which has different host names. I want to sort the file based on host name, which is in 3rd filed and needs to create a file for each host. For example, if out of 1000 records, 10... (6 Replies)
Discussion started by: ace_friends22
6 Replies

7. Shell Programming and Scripting

Awk based script to find the median of all individual columns in a data file

Hi All, I have some data like below. Step1,Param1,Param2,Param3 1,2,3,4 2,3,4,5 2,4,5,6 3,0,1,2 3,0,0,0 3,2,1,3 ........ so on Where I need to find the median(arithmetic) of each column from Param1...to..Param3 for each set of Step1 values. (Sort each specific column, if the... (5 Replies)
Discussion started by: ks_reddy
5 Replies

8. Shell Programming and Scripting

awk based script to find the average of all the columns in a data file

Hi All, I need the modification for the below mentioned code (found in one more post https://www.unix.com/shell-programming-scripting/27161-script-generate-average-values.html) to find the average values for all the columns(but for a specific rows) and print the averages side by side. I have... (4 Replies)
Discussion started by: ks_reddy
4 Replies

9. Shell Programming and Scripting

Find repeated word and take sum of the second field to it ,for all the repeated words in awk

Hi below is the input file, i need to find repeated words and sum up the values of it which is second field from the repeated work.Im trying but getting no where close to it.Kindly give me a hint on how to go about it Input fruits,apple,20,fruits,mango,20,veg,carrot,12,veg,raddish,30... (11 Replies)
Discussion started by: 100bees
11 Replies

10. Shell Programming and Scripting

awk script to find data in three file and perform replace operation

Have three files. Any other approach with regards to file concatenation or splitting, etc is appreciated If column55(billngtype) of file1 contains YMNC or YPBC then pick the value of column13(documentnumber). Now find this documentnumber in column1(Billdoc) of file2 and grep the corresponding... (4 Replies)
Discussion started by: as7951
4 Replies
ADD(2)								System Calls Manual							    ADD(2)

NAME
add, sub, mul, div, raddp, rsubp, rmul, rdiv, rshift, inset, rcanon, eqpt, eqrect, ptinrect, rectinrect, rectXrect, rectclip, Dx, Dy, Pt, Rect, Rpt - arithmetic on points and rectangles SYNOPSIS
#include <u.h> #include <libc.h> #include <libg.h> Point add(Point p, Point q) Point sub(Point p, Point q) Point mul(Point p, int a) Point div(Point p, int a) Rectangle raddp(Rectangle r, Point p) Rectangle rsubp(Rectangle r, Point p) Rectangle rmul(Rectangle r, int a) Rectangle rdiv(Rectangle r, int a) Rectangle rshift(Rectangle r, int a) Rectangle inset(Rectangle r, int n) Rectangle rcanon(Rectangle r) int eqpt(Point p, Point q) int eqrect(Rectangle r, Rectangle s) int ptinrect(Point p, Rectangle r) int rectinrect(Rectangle r, Rectangle s) int rectXrect(Rectangle r, Rectangle s) int rectclip(Rectangle *rp, Rectangle b) int Dx(Rectangle r) int Dy(Rectangle r) Point Pt(int x, int y) Rectangle Rect(int x0, int y0, int x1, int y1) Rectangle Rpt(Point p, Point q) DESCRIPTION
The functions Pt, Rect and Rpt construct geometrical data types from their components. These are implemented as macros. Add returns the Point sum of its arguments: Pt(p.x+q.x, p.y+q.y). Sub returns the Point difference of its arguments: Pt(p.x-q.x, p.y-q.y). Mul returns the Point Pt(p.x*a, p.y*a). Div returns the Point Pt(p.x/a, p.y/a). Raddp returns the Rectangle Rect(add(r.min, p), add(r.max, p)); rsubp returns the Rectangle Rpt(sub(r.min, p), sub(r.max, p)). Rmul returns the Rectangle Rpt(mul(r.min,a), mul(r.max,a)); Rdiv returns the Rectangle Rpt(div(r.min,a), div(r.max,a)). Rshift returns the rectangle r with all coordinates either left-shifted or right-shifted by a, depending on whether a is positive or nega- tive, respectively. Inset returns the Rectangle Rect(r.min.x+n, r.min.y+n, r.max.x-n, r.max.y-n). Rcanon returns a rectangle with the same extent as r, canonicalized so that min.x <= max.x, and min.y <= max.y. Eqpt compares its argument Points and returns 0 if unequal, 1 if equal. Eqrect does the same for its argument Rectangles. Ptinrect returns 1 if p is a point within r, and 0 otherwise. Rectinrect returns 1 if all the pixels in r are also in s, and 0 otherwise. RectXrect returns 1 if r and s share any point, and 0 otherwise. Rectclip clips in place the Rectangle pointed to by rp so that it is completely contained within b. The return value is 1 if any part of *rp is within b. Otherwise, the return value is 0 and *rp is unchanged. The functions Dx and Dy give the width (x) and height (y) of a Rectangle. They are implemented as macros. SOURCE
/sys/src/libg SEE ALSO
graphics(2) ADD(2)
All times are GMT -4. The time now is 11:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy