#!/usr/bin/perl $d = "0000"; while(<>) { s/printf\(\"\#\d+\:/printf\(\"\#$d\:/; s/printf\(\"([^#])/printf\(\"\#$d\:$1/; $d++; print; }