I have a perl script that opens up a text file and displays the data fine. My textfile:> 60, and display that like so:
111.111.111.1-25|DEPTA 222.222.222.50-60|DEPTB
What I would like to do is have it increment 1 through 25, and 50 through
Try something like this:
#!/usr/bin/perl -nlw if (/(.*)\b(\d+)-(\d+)\b(.*)/) { print "$1$_$4" for $2..$3; } else { print; }
If the line is "something, number-number, something" it iterates from the first number to the second one ($2..$3) printing the line for every number in the sequence (which is in $_). Otherwise it just prints the original line.
-zsdc.
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]