Sponsored Content
Top Forums UNIX for Dummies Questions & Answers IPv4 addresses: count/output and Awk/Sed Post 302208652 by ripat on Tuesday 24th of June 2008 01:52:18 PM
Old 06-24-2008
- How do you genarate $iplist and $rdnslist
- what occurrences do you want to count?

Can you also give exact output you want.
 

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
Paranoid::Network::IPv4(3pm)				User Contributed Perl Documentation			      Paranoid::Network::IPv4(3pm)

NAME
Paranoid::Network::IPv4 - IPv4-related functions VERSION
$Id: IPv4.pm,v 0.1 2012/05/29 21:37:44 acorliss Exp $ SYNOPSIS
use Paranoid::Network::IPv4; @net = ipv4NetConvert($netAddr); $rv = ipv4NetIntersect($net1, $net2); or use Paranoid::Network::IPv4 qw(:all); print "Valid IP address " if $netAddr =~ /^@{[ IPV4REGEX ]}$/; @net = ipv4NetConvert($netAddr); $broadcast = $net[IPV4BRDCST]; DESCRIPTION
This module contains a few convenience functions for working with IPv4 addresses. By default only the subroutines themselves are imported. Requesting :all will also import the constants as well. SUBROUTINES
/METHODS ipv4NetConvert @net = ipv4NetConvert($netAddr); This function takes an IPv4 network address in string format and converts it into an array containing the base network address, the broadcast address, and the netmask, in integer format. The network address can have the netmask in either CIDR format or dotted quads. In the case of a single IP address, the array with only have one element, that of the IP in integer format. Passing any argument to this function that is not a string representation of an IP address (including undef values) will cause this function to return an empty array. ipv4NetIntersect $rv = ipv4NetIntersect($net1, $net2); This function tests whether an IP or subnet intersects with another IP or subnet. The return value is essentially boolean, but the true value can vary to indicate which is a subset of the other: -1: destination range encompasses target range 0: both ranges do not intersect at all 1: target range encompasses destination range The function handles the same string formats as ipv4NetConvert, but will allow you to test single IPs in integer format as well. CONSTANTS
These are only imported if explicity requested or with the :all tag. MAXIPV4CIDR Simply put: 32. This is the largest CIDR notation supported in IPv4. IPV4REGEX Regular expression: qr/(?:d{1,3}.){3}d{1,3}/sm You can use this for validating IP addresses as such: $ip =~ m#^@{[ IPV4REGEX ]}$#; or to extract potential IPs from extraneous text: (@ips) = ( $string =~ m#(@{[ IPV4REGEX ]})#gsm); IPV4CIDRRGX Regular expression: qr#(@{[ IPV4REGEX ]})(?:/(d+|@{[ IPV4REGEX ]}))?#sm By default this will extract an IP or CIDR notation network address: ($net, $mask) = ( $ip =~ m#^@{[ IPV4CIDRRGX ]}$# ); In the case of a simple IP address $mask will be undefined. IPV4BASE This is the ordinal index of the base network address as returned by ipv4NetConvert. IPV4BRDCST This is the ordinal index of the broadcast address as returned by ipv4NetConvert. IPV4MASK This is the ordinal index of the network mask as returned by ipv4NetConvert. DEPENDENCIES
o Paranoid o Paranoid::Network::Socket BUGS AND LIMITATIONS
AUTHOR
Arthur Corliss (corliss@digitalmages.com) LICENSE AND COPYRIGHT
This software is licensed under the same terms as Perl, itself. Please see http://dev.perl.org/licenses/ for more information. (c) 2012, Arthur Corliss (corliss@digitalmages.com) perl v5.14.2 2012-05-29 Paranoid::Network::IPv4(3pm)
All times are GMT -4. The time now is 03:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy