[Solved] perl + numeration word or parameter in file


It can be condensed to a one line perl script pretty easily, though I don’t particularly recommend it if you want readability:

#!/usr/bin/perl
s/(.*)=/$k{$1}++;"$1$k{$1}="/e and print while <>;

This version reads from a specified file, rather than using the command line:

#!/usr/bin/perl
open IN, "/tmp/file";
s/(.*)=/$k{$1}++;"$1$k{$1}="/e and print while <IN>;

6

solved perl + numeration word or parameter in file