Q:

tcl : lsort -dictionary replace new lines by spaces

I use the following command to sort the content of a string
set local_object [lsort -dictionary $list_object] 

this comand will replace new lines by spaces 
how to avoid that ? 

A:

lsort assumes that its argument is a Tcl list.   Any whitespace including newlines can separate elements of that list, but will not be preserved in the output.   If you want to format the output list with one element per line you could do:
set local_object [join [lsort -dictionary $list_object] "\n"]

