On 04/03/2018, at 08:29, Oh My Car! <[email protected] <http://ohmycar.it/>> 
wrote:
> I apologize for abusing of your kindness but would be really grateful if you 
> could let me know what I should modify to get numbers as suffix instead of 
> letters.
> Maybe when duplicates are quite a lot will be easier to track them down :)


Hey Mariella,

No worries.  It was an easy change to make.


#!/usr/bin/env perl -sw
use v5.010; use open qw(:std :utf8); use utf8;

my ($cntr, $tempItem);

$tempItem = "";
$cntr = 0;

while(<>){
   if ( /(\[[a-z]+\d+)(\])/i ) {
      if ( $tempItem eq "$&" ) {
         ++$cntr;
         say "$1_".sprintf('%03d',$cntr)."$2";
      } else {
         $tempItem = $&;
         $cntr = 0;
         print;
      }
   }

}


I've padded the dupe-number, so you have up to 999 nicely aligned dupe-names.

[FK410004]
[FK410004_001]
[FK410009]
[FK410009_001]
[FK410009_002]
[FK410009_003]
[FK410009_004]

You can change that by altering the number in sprintf('%03d'.

--
Best Regards,
Chris

-- 
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].
Visit this group at https://groups.google.com/group/bbedit.

Reply via email to