in reply to Txet Maglning Glof, Ayobndy?
Updated: I originally missed the part about keeping the last letter as per Cody Pendant's comment below. Also, some words will be randomly mangled back to the same word and words less than four letters won't be changed.perl -pe 's/(\w)(\w+)(\w)/split"",$2;$,="";$,.=splice@_,rand@_,1while@ +_;$1.$,.$3/eg' file
A shorter variation:
perl -pe 's/(?<=\w)\w+(?=\w)/split$,,$&;my$s;$s.=splice@_,rand@_,1whi +le@_;$s/eg' file
--
John.
|
|---|