I have the following text-filter:

#!/usr/bin/perl -w

while(<>) {
        my $line = $_;  
        $line =~ s/(\d+)/($1 + 1)/ge;
        print $line;
}

Which doesn’t exactly do what I want it to do, in that it increments the number 
on each line (or each selected line) and what I want is for the script to 
create a NEW line with an incremented number.

For example, if I have a file that contains


Text 980
Text 981

Then running the script would yield:

Text 980
Text 981
Text 982

It would be even better if it could ask how many new lines I want so I could 
add 100 or 1000 incremented lines all at once.

I’m sure this has been covered on the list before, but I can’t seem to find it.


-- 
'I'm not a thief, madam. But if I were, I would be the kind that steals
fire from the gods.' 'We've already got fire.' 'There must be an upgrade
by now.'

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].

Reply via email to