Sponsored Content
Top Forums Shell Programming and Scripting Fill in missing numbers in range Post 302073582 by bistru on Tuesday 16th of May 2006 03:34:25 AM
Old 05-16-2006
Sorry.

I read the list from one file, and want to write to a new file. The only condition is that i want to have "complete" listing, with a complete range from the lowest number to the highest number, which in this case is from 1-7.

Thanks for your response!
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

fill in missing columns

It can't be that hard, but I just can't figure it out: I have file like: File Sub-brick M_1 S_1 M_2 S_2 M_4 S_4 ... xxx 1 214 731 228 621 132 578 ... and would like to get 0 0 where M_3 S_3 is missing xxx 1 214 731 228 621 0 0 132 578 ... I wrote following script, but can't figure out... (3 Replies)
Discussion started by: avvk
3 Replies

2. UNIX for Dummies Questions & Answers

Help required on Printing of Numbers, which are missing in the range

Hi Experts, Need help on printing of numbers, which are missing in the range. Pls find the details below Input 1000000002 1000000007 1234007940 1234007946 Output 1000000003 1000000004 1000000005 1000000006 1234007941 (2 Replies)
Discussion started by: krao
2 Replies

3. Shell Programming and Scripting

Fill missing numbers in second column with zeros

Hi All, I have 100 files with names like this: 1.dat, 2.dat, 3.dat until 100.dat. My dat files look like this: 42323 0 438939 1 434 0 0.9383 3434 120.23 3 234 As you can see in the second column, some numbers are missing. I want to fill those missing places with 0's in all... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies

4. Shell Programming and Scripting

Fill missing values with 2

Hi All, I have 100 .txt files which look like this: 3 4 5 6 7 Now, some files have some numbers missing in them and they look like this: 4 5 6 (6 Replies)
Discussion started by: shoaibjameel123
6 Replies

5. Shell Programming and Scripting

Fill in missing Data

hello everyone, I have a task to input missing data into a file. example of my data below: Wed Feb 01 09:00:02 EST 2012,,,0.4,0.3,,0.3,,0.3,,0.5,,0.3,,,0.4,0.3, Wed Feb 01 09:00:11 EST 2012,,,,,,,0.2,,,,,,,,,, Wed Feb 01 09:00:22 EST... (23 Replies)
Discussion started by: Nolph
23 Replies

6. Shell Programming and Scripting

Fill data if number range is given

Hi I want to get all numbers if number range is given as input. Eg: INPUT FILE 100-105 107 108-112 OUTPUT REQUIRED: 100 101 102 103 104 105 107 108 109 110 111 112 How can I do it using shell? :confused: Thanks in advance. (11 Replies)
Discussion started by: dashing201
11 Replies

7. Shell Programming and Scripting

Fill in missing rows with zero to have uniform table

Hello, I have two files of same structure except some rows are missing randomly in each file. How do I fill the missing rows to have the exact ID column (S01 ~ S96) and rest columns filled with "0" with awk? The purpose of this step is to join the two files side by side. The closest thread is... (17 Replies)
Discussion started by: yifangt
17 Replies

8. Shell Programming and Scripting

Check/print missing number in a consecutive range and remove duplicate numbers

Hi, In an ideal scenario, I will have a listing of db transaction log that gets copied to a DR site and if I have them all, they will be numbered consecutively like below. 1_79811_01234567.arc 1_79812_01234567.arc 1_79813_01234567.arc 1_79814_01234567.arc 1_79815_01234567.arc... (3 Replies)
Discussion started by: newbie_01
3 Replies

9. Shell Programming and Scripting

Fill in missing values

Hi, I have a data sample as shown below. I want to fill in the left column so that the line will be continuous. For example, between 1 and 5 should be 2,3,4. And corresponding values in the right column will be 0. Thus the expected data should look like that: 1 1 1 10 1 2 1 3 1 5 1 6 2 0... (6 Replies)
Discussion started by: theanh0508
6 Replies
Net::Subnets(3pm)					User Contributed Perl Documentation					 Net::Subnets(3pm)

NAME
Net::Subnets - Computing Subnets In Large Scale Networks SYNOPSIS
use Net::Subnets; my $sn = Net::Subnets->new; $sn->subnets(@subnets); if (my $subnetref = $sn->check($address)) { ... } my ($lowipref, highipref) = $sn->range($subnet); my $listref = $sn->list(($lowipref, $highipref)); DESCRIPTION
Very fast matches large lists of IP addresses against many CIDR subnets and calculates IP address ranges. This is a simple and efficient example for subnet matching: use Net::Subnets; my @subnets = qw(10.0.0.0/24 10.0.1.0/24); my @addresses = qw/10.0.0.1 10.0.1.2 10.0.3.1/; my $sn = Net::Subnets->new; $sn->subnets(@subnets); my $results; foreach my $address (@addresses) { if (my $subnetref = $sn->check($address)) { $results .= "$address: $$subnetref "; } else { $results .= "$address: not found "; } } print($results); This is a simple example for range calculation: use Net::Subnets; my @subnets = qw(10.0.0.0/24 10.0.1.0/24); my $sn = Net::Subnets->new; my $results; foreach my $subnet (@subnets) { my ($lowipref, $highipref) = $sn->range($subnet); $results .= "$subnet: $$lowipref - $$highipref "; } print( $results ); This is a simple example for list generation: use Net::Subnets; my $lowip = '192.168.0.1'; my $highip = '192.168.0.100'; my $sn = Net::Subnets->new; my $listref = $sn->list(($lowip, $highip)); foreach my $address (@$listref) { # do something cool } METHODS
"new" my $subnets = Net::Subnets->new; Creates an "Net::Subnets" object. "subnets" $subnets->subnets([qw(10.0.0.0/24 10.0.1.0/24)]); The C<subnets> method lets you prepare a list of CIDR subnets. "check" my $match = $subnets->check($address); The C<check> method lets you check an IP address against the previously prepared subnets. "range" my ($lowest, $highest) = $subnets->range($subnet) The C<range> method lets you calculate the IP address range of a subnet. "list" my $list = $subnets->list($lowest, $highest); The C<list> method lets you calculate a list containing all IP addresses in a given range. AUTHOR
Sebastian Riedel (sri@cpan.org), Juergen Peters (juergen.peters@taulmarill.de) COPYRIGHT AND LICENSE
Copyright (C) 2003-2009, Sebastian Riedel. This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0. perl v5.10.1 2009-12-18 Net::Subnets(3pm)
All times are GMT -4. The time now is 03:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy