Sponsored Content
Full Discussion: Filter a list of IPs
Top Forums Shell Programming and Scripting Filter a list of IPs Post 302494564 by Chubler_XL on Monday 7th of February 2011 04:18:41 PM
Old 02-07-2011
How about this to load (and strip) all your IP*.txt files and then process dumpfile, it also ensures IPs contain valid (0-255) values.

Code:
awk '
BEGIN {
  p = "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])"
  p = p "\\." p "\\." p "\\." p
}
$0 ~ p { gsub("[ \t]",""); a[$0] }
END {
  while (getline < "dumpfile")
     if (!($0 in a)) print $0;
}' IP*.txt


Last edited by Chubler_XL; 02-08-2011 at 09:14 PM..
 

9 More Discussions You Might Find Interesting

1. AIX

Get the list, filter and delete the files on remote server

Hi, I need to login to a remote server. Go to a particular path. Get the lists of files on that path.There may be n number of files. I need to delete only those files from above created list which are 7 days older. I have achieved above using ftp protocol, but now the constraint has... (0 Replies)
Discussion started by: mail_amitnagpal
0 Replies

2. Shell Programming and Scripting

Filter the file list greater then the size specified by user

HI, Can any tell me how to filter the list of files greater than the size specified by user. The size should be provided by user as an input. Regards shiva (6 Replies)
Discussion started by: shivu
6 Replies

3. Shell Programming and Scripting

List of IPs & database lookup

I am trying to feed a list of IP's to do lookups from a database. My script works only for the first IP but all subsequent IPs output as 'unknown'. #!/usr/bin/php -q <? $ip = file('ip.txt'); foreach ($ip as $ip_num => $ip) { echo $ip; $out=sprintf("%u", ip2long($ip)); ... (1 Reply)
Discussion started by: hazno
1 Replies

4. Shell Programming and Scripting

Filter only gz files from list of subdirectories

Hi, I have a very big directory structure that consists of many sub-directories inside.There are around 50 ".gz" files under this dir structure. I want to copy all the gz files alone to a seperate location. Plz help me. (2 Replies)
Discussion started by: villain41
2 Replies

5. Shell Programming and Scripting

Copying a files from a filter list and creating their associated parent directories

Hello all, I'm trying to copy all files within a specified directory to another location based on a find filter of mtime -1 (Solaris OS). The issue that I'm having is that in the destination directory, I want to retain the source directory structure while copying over only the files that have... (4 Replies)
Discussion started by: hunter55
4 Replies

6. Shell Programming and Scripting

Get Ips from a list file

Hi Everyone, I typed a command: awk '{ print $1}' $LOGFILE | sort | uniq -c | sort -nr > $DEST/a.txt And I got file a.txt which show 6 1.1.1.1 3 2.2.2.2 2 3.3.3.3 1 4.4.4.4 Just now, I want to get exact ips which has first column > 5 to a file b.txt. In this situation, the... (5 Replies)
Discussion started by: testcase
5 Replies

7. Shell Programming and Scripting

Help with shell script - filter txt file full of ips

Hello again gentlemen. I would like to make a shell script to 'optimize' a plain text full of IPs. Let's suppose to have this text file: 1.192.63.253-1.192.63.253 1.0.234.46/32 1.1.128.0/17 1.116.0.0/14 1.177.1.157-1.177.1.157 1.23.22.19 1.192.61.0-1.192.61.99 8.6.6.6 I want to... (2 Replies)
Discussion started by: accolito
2 Replies

8. AIX

Get List of users+IPs

Hello! We have an AIX box (6.3), we are looking for a way to get list of logged in users and their IP. The issue we have is running who -ub shows hostname and we are wanting to get the ip. Any suggestions of ideas? Thanks in advance for any help! (4 Replies)
Discussion started by: entropy1980
4 Replies

9. Shell Programming and Scripting

Filter and delete numbers in a list

Hello, I've got a list of a single column numbers like 3000.66 3002.55 3062.23 3242.12 etc... I would like to delete all numbers higher than for example 3060.00 and lower than 2990.00 How can I do that? Thanks in advance (2 Replies)
Discussion started by: Board27
2 Replies
vpardump(1M)															      vpardump(1M)

NAME
vpardump - manage monitor dump files SYNOPSIS
[vparmon[dumpfile]] DESCRIPTION
The command is used to create (on PA-RISC systems only) and analyze a virtual partition monitor dump file. vparmon is the image of the virtual partition monitor and dumpfile is the crash dump file corresponding to that image. is normally run from the rc script to analyze a crash dump during HP-UX boot. If no options are specified, checks if the dumpfile has been cleared. If not, it analyzes dumpfile and prints information about the crash to standard out. Then marks the dumpfile as clear. If dumpfile is not specified, the string is appended to vparmon as in If vparmon is not specified, it defaults to The dumpfile must exist prior to a vpar monitor crash. On PA-RISC systems, the and options create the dumpfile on PA-RISC. If is used, a dumpfile is created that is large enough to contain the monitor image. If additional structures are required, such as I/O Page Directo- ries, the option is used to reserve space for a full monitor crash dump. On Itanium(R)-based systems, the monitor dumpfile is created in the EFI partition of the monitor's boot disk as needed. It is not necessary to pre-allocate a dump file in A monitor dump typically requires less than 75 megabytes of free space in the EFI partition. In order to ensure that a complete crash dump can be saved, this much free space must be maintained in the EFI partition. Options recognizes the following command-line options: Analyze the dumpfile. This option can be used to force an analysis even if dumpfile has been cleared. Mark dumpfile as clear. No analysis is performed. Analyze dumpfile even if the versions do not match. Initialize dumpfile for a full dump. Supported only on PA-RISC systems. Initialize dumpfile for a normal dump. Supported only on PA-RISC systems. Do not analyze the dumpfile. Enable verbose output. The and options are allowed on Itanium-based systems for compatibility. No action is taken for the and options. Operands recognizes the following command-line operands: vparmon The name of the image of the virtual partition monitor. If vparmon is not specified, it defaults to dumpfile The name of the crash dump file corresponding to the image of the virtual partion monitor. If dumpfile is not specified, the string is appended to vparmon as in Security Restrictions This command is restricted to processes owned by superuser or with the privilege. See privileges(5) for more information about privileged access on systems that support fine-grained privileges. RETURN VALUE
returns the following values: Analyzed dumpfile successfully. Created a new dumpfile. A dumpfile does not exist. The dumpfile is cleared, no action taken. Error attempting to create a dumpfile. Error analyzing the dumpfile. Command syntax error. EXAMPLES
Analyze the default dumpfile and create it if it does not exist: Suppress the analysis of the default dumpfile, and reserve space for a full dump: AUTHOR
was developed by the Hewlett-Packard Company. SEE ALSO
vparextract(1M), privileges(5). vpardump(1M)
All times are GMT -4. The time now is 06:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy