Sponsored Content
Top Forums UNIX for Dummies Questions & Answers IPv4 addresses: count/output and Awk/Sed Post 302208630 by laebshade on Tuesday 24th of June 2008 12:03:14 PM
Old 06-24-2008
Here is the output of one match to that grep (it has been obfuscated):

Quote:
Delivered-To: xx@xx
Received: from gmail-pop.l.google.com [72.14.205.111]
by xx with POP3 (fetchmail-6.3.8)
for <xx@localhost> (single-drop); Tue, 24 Jun 2008 11:28:22 -0400 (EDT)
Received: by xx with SMTP id i17cs35177and;
Tue, 24 Jun 2008 08:42:03 -0700 (PDT)
Received: by xx with SMTP id j5mr16112468anc.3.1214322113210;
Tue, 24 Jun 2008 08:41:53 -0700 (PDT)
Return-Path: <root@xx>
Received: from xx (xx [xx])
by mx.google.com with ESMTP id z52si2728230pyg.1.2008.06.24.08.41.49;
Tue, 24 Jun 2008 08:41:52 -0700 (PDT)
Received-SPF: pass (google.com: domain of root@xx designates xx as permitted sender) client-ip=xx;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of root@xx designates xx as permitted sender) smtp.mail=root@xx
Return-Path: <root@xx>
Received: from [xx] ([2xx:41897] helo=xx)
by xx (envelope-from <root@xx>)
(xx 2.2.1.21 r(19176)) with ESMTP
id 40/AB-02382-59511684; Tue, 24 Jun 2008 11:41:14 -0400
Received: from xx ([xx] helo=xx)
by xx with esmtp (xx 4.51)
id 1KBAdl-0001GL-2O
for xx@xx; Tue, 24 Jun 2008 11:41:05 -0400
Received: from [xx] ([xx:56919] helo=xx)
by xx (ecelerity 2.1.1.23 r(18304)) with ESMTP
id BD/75-07415-09511684 for <xx>; Tue, 24 Jun 2008 11:41:04 -0400
Received: by xx (Postfix, from userid 0)
id B46B9103AB; Tue, 24 Jun 2008 11:41:02 -0400 (EDT)
Subject: [xxx] xxx
Cc: xx
From: xx
Message-Id: <20080624154102.B46B9103AB@xx>
Date: Tue, 24 Jun 2008 11:41:02 -0400 (EDT)


76.11.221.51
The IP is always at the end of the match/email (the e-mails are text files generated by fetchmail); normally there are multiple IPs, but it's always one IP per line.

Last edited by laebshade; 06-24-2008 at 01:15 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

count number of fields not using SED or AWK

hi forums i need help with a little problem i am having. i need to count the number of fields that are in a saved variable so i can use that number to make a different function work properly. is there a way of doing this without using SED/AWK? anything would be greatly appreciated (4 Replies)
Discussion started by: strasner
4 Replies

2. Shell Programming and Scripting

count and number instances of a character in sed or awk

I currently use LaTeX together with a sed script to set cloze test papers for my students. I currently pepend and equals sign to the front of the words I want to leave out in the finished test, =perpendicular, for example. I am able to number the blanks using a variable in LaTeX. I would like to... (8 Replies)
Discussion started by: maouinin
8 Replies

3. UNIX for Advanced & Expert Users

Using awk or sed need the output in the new file

Please find the input file as given below: 2012/02/29 11:00:00~~CRITICAL~For customer 00000476 no daily files were found in the 010137933 account directory. 2012/02/29 11:00:00~~CRITICAL~For customer 05006802 no daily files were found in the 010115166 account directory. 2012/02/29... (0 Replies)
Discussion started by: av_sagar
0 Replies

4. Shell Programming and Scripting

need awk or sed help to reformat output

We have the following output: server1_J00_data_20120711122243 server1_J00_igs_20120711122243 server1_J00_j2ee_20120711122243 server1_J00_sec_20120711122243 server1_J00_data_20120711131819 server1_J00_igs_20120711131819 server1_J00_j2ee_20120711131819 server2_J00_data_20120711122245... (10 Replies)
Discussion started by: ux4me
10 Replies

5. Shell Programming and Scripting

Output on one line using awk or sed

I have a file of 100,000 lines in the below format: answer.bed chr1 957570 957852 NOC2L chr1 976034 976270 PERM1 chr1 976542 976787 PERM1 I need to get each on one line and so far what I have tried doesn't seem to be working. Thank you... (3 Replies)
Discussion started by: cmccabe
3 Replies

6. Shell Programming and Scripting

awk output is not the correct count

The awk below runs and produces the following output on the file2. This is just an example of the format as the file is ~14MB. file1.txt is attached. I am trying to count the ids that match between the two files and out the ids that are missing. Thank you :). file2 970 NM_213590 ... (2 Replies)
Discussion started by: cmccabe
2 Replies

7. Solaris

How to assign IPv4 and IPv6 addresses with same interface?

Hello dears how to assign IPv4 and IPv6 addresses with same interface on solaris 10 (1 Reply)
Discussion started by: ttashman
1 Replies

8. Shell Programming and Scripting

awk to output match and mismatch with count using specific fields

In the below awk I am trying output to one file those lines that match between $2,$3,$4 of file1 and file2 with the count in (). I am also trying to output those lines that are missing between $2,$3,$4 of file1 and file2 with the count of in () each. Both input files are tab-delimited, but the... (7 Replies)
Discussion started by: cmccabe
7 Replies

9. UNIX for Beginners Questions & Answers

awk or sed script to count number of occurrences and creating an average

Hi Friends , I am having one problem as stated file . Having an input CSV file as shown in the code U_TOP_LOGIC/U_HPB2/U_HBRIDGE2/i_core/i_paddr_reg_2_/Q,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,0... (4 Replies)
Discussion started by: kshitij
4 Replies

10. UNIX for Beginners Questions & Answers

How to find the count of IP addresses that belong to different subnets and display the count?

Hi, I have a file with a list of bunch of IP addresses from different VLAN's . I am trying to find the list the number of each vlan occurence in the output Here is how my file looks like 1.1.1.1 1.1.1.2 1.1.1.3 1.1.2.1 1.1.2.2 1.1.3.1 1.1.3.2 1.1.3.3 1.1.3.4 So what I am trying... (2 Replies)
Discussion started by: new2prog
2 Replies
PCAP_FINDALLDEVS(3PCAP) 												   PCAP_FINDALLDEVS(3PCAP)

NAME
pcap_findalldevs, pcap_freealldevs - get a list of capture devices, and free that list SYNOPSIS
#include <pcap/pcap.h> char errbuf[PCAP_ERRBUF_SIZE]; int pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf); void pcap_freealldevs(pcap_if_t *alldevs); DESCRIPTION
pcap_findalldevs() constructs a list of network devices that can be opened with pcap_create() and pcap_activate() or with pcap_open_live(). (Note that there may be network devices that cannot be opened by the process calling pcap_findalldevs(), because, for example, that process does not have sufficient privileges to open them for capturing; if so, those devices will not appear on the list.) If pcap_findalldevs() succeeds, the pointer pointed to by alldevsp is set to point to the first element of the list, or to NULL if no devices were found (this is considered success). Each element of the list is of type pcap_if_t, and has the following members: next if not NULL, a pointer to the next element in the list; NULL for the last element of the list name a pointer to a string giving a name for the device to pass to pcap_open_live() description if not NULL, a pointer to a string giving a human-readable description of the device addresses a pointer to the first element of a list of network addresses for the device, or NULL if the device has no addresses flags device flags: PCAP_IF_LOOPBACK set if the device is a loopback interface Each element of the list of addresses is of type pcap_addr_t, and has the following members: next if not NULL, a pointer to the next element in the list; NULL for the last element of the list addr a pointer to a struct sockaddr containing an address netmask if not NULL, a pointer to a struct sockaddr that contains the netmask corresponding to the address pointed to by addr broadaddr if not NULL, a pointer to a struct sockaddr that contains the broadcast address corresponding to the address pointed to by addr; may be null if the device doesn't support broadcasts dstaddr if not NULL, a pointer to a struct sockaddr that contains the destination address corresponding to the address pointed to by addr; may be null if the device isn't a point-to-point interface Note that the addresses in the list of addresses might be IPv4 addresses, IPv6 addresses, or some other type of addresses, so you must check the sa_family member of the struct sockaddr before interpreting the contents of the address; do not assume that the addresses are all IPv4 addresses, or even all IPv4 or IPv6 addresses. IPv4 addresses have the value AF_INET, IPv6 addresses have the value AF_INET6 (which older operating systems that don't support IPv6 might not define), and other addresses have other values. Whether other addresses are returned, and what types they might have is platform-dependent. For IPv4 addresses, the struct sockaddr pointer can be interpreted as if it pointed to a struct sockaddr_in; for IPv6 addresses, it can be interpreted as if it pointed to a struct sockaddr_in6. The list of devices must be freed with pcap_freealldevs(), whch frees the list pointed to by alldevs. RETURN VALUE
pcap_findalldevs() returns 0 on success and -1 on failure; as indicated, finding no devices is considered success, rather than failure, so 0 will be returned in that case. If -1 is returned, errbuf is filled in with an appropriate error message. errbuf is assumed to be able to hold at least PCAP_ERRBUF_SIZE chars. SEE ALSO
pcap(3PCAP), pcap_create(3PCAP), pcap_activate(3PCAP), pcap_open_live(3PCAP) 22 August 2010 PCAP_FINDALLDEVS(3PCAP)
All times are GMT -4. The time now is 07:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy