1 2 3 4 5
# bash x=$(for i in {1..7} {6..1};do echo -n "`seq -s '' $i` ";done) echo $x 1 12 123 1234 12345 123456 1234567 123456 12345 1234 123 12 1
1 2
echo $x | perl -pe 's/(?<=\d)(?=(\d\d\d)+\b)/./ while(/\d{5,}/)' 1 12 123 1.234 12.345 123.456 1.234.567 123.456 12.345 1234 123 12 1
echo $x|perl -nE'while(/\d{5,}/){$b=$`;$m=$&;$a=$'\'';$m=~s/(?<=\d)(?=(\d\d\d)+\b)/./;$_="$b$m$a"}print'
1 2 3
echo 1970 2014 3000 20000 | perl -ne 'while(/\d{5,}|[3-9]\d{3}/) {$b=$`; $m=$&; $a=$'\''; $m=~s/(?<=\d)(?=(\d\d\d)+\b)/./; $_="$b$m$a"}; print' 1970 2014 3.000 20.000