perl -pe 's/,/|/ for ($_) x 10' #### perl -pe 'BEGIN {$n=shift} for my $c (1.. $n){ s/;/|/ }' 10 $files