perl - replace every nth (and multiples) occurrences of a character with another character
问题 Does anyone know any unix commands/perl script that would insert a specific character (that can be entered as either hex (ie 7C) or as the actual character (ie |)) in the position of the nth recurring occurence of a specific character. ie perl script.pl "," 3 "|" data.txt would replace every 3rd,6th,9th...etc comma with a pipe. So if data.txt had the following before the script was run: fd,3232,gfd67gf, peas,989767,jkdfnfgjhf, dhdhjsk,267,ujfdsy,fuyds,637296,ldosi,fduy, 873,fuisouyd,try save