Hello , is it possible to create a list with lacking numbers?
This list (a short example) starts with 'm b 157 n+ and as you can see, the numbers 160-165 are missing, can I create a list with those numbers in textad?
Thanks in advance
Jan
M b 157 N+
M b 158 N+
M b 159 N+
M b 166 N+
M b 174 N+
M b 180 N+
M b 183 N+
M b 185 N+
M b 187 N+
M b 188 N+
M b 205 N+
M b 207 N+
M b 209 N+
M b 210 N+
M b 216 N+
M b 217 N+
M b 218 N+
M b 219 N+
M b 220 N+
M b 221 N+
M b 222 N+
M b 225 N+
M b 226 N+
M b 229 N+
M b 231 N+
M b 232 N+
M b 233 N+
M b 234 N+
M b 234 N+
M b 239 N+
creating a list with missing numbers
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
You can, but you have to set up the required number of lines first. In your example you need 6 lines so create a file containing the following:
M b # N+
M b # N+
M b # N+
M b # N+
M b # N+
M b # N+
Then perform a Replace operation with the following parameters:
Find what: #
Replace with: \i(160)
Select Regular expression and click Replace All.
M b # N+
M b # N+
M b # N+
M b # N+
M b # N+
M b # N+
Then perform a Replace operation with the following parameters:
Find what: #
Replace with: \i(160)
Select Regular expression and click Replace All.
Thanks for your reaction,
I think this was a bad example/quistion of me
I mean how to discover the missing numbers and make a list of those numbers, between 157 and 239.
Jan
M b 157 N+
M b 158 N+
M b 159 N+
M b 166 N+
M b 174 N+
M b 180 N+
M b 183 N+
M b 185 N+
M b 187 N+
M b 188 N+
M b 205 N+
M b 207 N+
M b 209 N+
M b 210 N+
M b 216 N+
M b 217 N+
M b 218 N+
M b 219 N+
M b 220 N+
M b 221 N+
M b 222 N+
M b 225 N+
M b 226 N+
M b 229 N+
M b 231 N+
M b 232 N+
M b 233 N+
M b 234 N+
M b 234 N+
M b 239 N+
I think this was a bad example/quistion of me
I mean how to discover the missing numbers and make a list of those numbers, between 157 and 239.
Jan
M b 157 N+
M b 158 N+
M b 159 N+
M b 166 N+
M b 174 N+
M b 180 N+
M b 183 N+
M b 185 N+
M b 187 N+
M b 188 N+
M b 205 N+
M b 207 N+
M b 209 N+
M b 210 N+
M b 216 N+
M b 217 N+
M b 218 N+
M b 219 N+
M b 220 N+
M b 221 N+
M b 222 N+
M b 225 N+
M b 226 N+
M b 229 N+
M b 231 N+
M b 232 N+
M b 233 N+
M b 234 N+
M b 234 N+
M b 239 N+
Sorry for the misunderstanding. There's no simple way to do it that I can think of, but here's one solution, which doesn't actually use TextPad and which also requires a separate utility.
Firstly, create a file that contains the data with the missing numbers. Call this file short.txt.
Second, create another file, called long.txt, containing the complete set of lines from 157 to 239, as follows:
Firstly, create a file that contains the data with the missing numbers. Call this file short.txt.
Second, create another file, called long.txt, containing the complete set of lines from 157 to 239, as follows:
- Open a Command Prompt window.
- Enter the command: for /L %I in (157,1,239) do echo M b %I N+>>long.txt
- Download this set of Unix-like utilities: http://sourceforge.net/projects/unxutils/
- Extract the file usr\local\wbin\comm.exe from the archive UnxUtils.zip.
- At the command prompt, enter the command: comm -1 -3 short.txt long.txt
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
Then this might be a solution:
where missingnums.pl is
Code: Select all
perl missingnums.pl input.txt
Code: Select all
use warnings ;
use strict ;
my %nums ;
while ( my $line = <> )
{
my $n = ( $line =~ /(\d+)/ )[ 0 ] ;
$nums{ $n } = 1 ;
}
my @nums = sort keys %nums ;
my $lo = $nums[ 0 ] ;
my $hi = $nums[ $#nums ] ;
for my $n ( $lo .. $hi )
{
if ( ! $nums{ $n } )
{
print "$n\n" ;
}
}