Hello
I will answer to everybody in a single message.
First point, I say thank you to every helpers.
The code : set leFichier to (path to desktop as text )&"2mrs_1175_done.txt" set myText to read file leFichier set fixedText to do shell script "ruby -e \"puts " & quoted form of myText & ".gsub(/ +/,' ')\""
returns : … 23520287+2102068 358.01202 21.03524 104.81102 -39.73748 11.754 12.069 12.768 11.647 11.958 12.583 0.059 0.038 0.029 0.059 0.042 0.032 0.074 1.193 1.424 0.500 0333 98 NN 13233 33 F 20112MRS.FLWO.0000H 23520287+2102068 '.gsub(/ +/,' ')\"" --> error "La commande s’est arrêtée avec un état non nul." number 255
The code : set leFichier to (path to desktop as text) & "2mrs_1175_done.txt" set the_path_qUnix to quoted form of POSIX path of (leFichier as text)
set fixedText to do shell script "sed -Ee 's/ +/ctrl-i/g' " & the_path_qUnix
return this kind of data : 23520287+2102068ctrl-i358.01202ctrl-i21.03524ctrl-i104.81102ctrl-i-39.73748ctrl-i11.754ctrl-i12.069ctrl-i12.768ctrl-i11.647ctrl-i11.958ctrl-i12.583ctrl-i0.059ctrl-i0.038ctrl-i0.029ctrl-i0.059ctrl-i0.042ctrl-i0.032ctrl-i0.074ctrl-i1.193ctrl-i1.424ctrl-i0.500ctrl-i0333ctrl-i98ctrl-iNNctrl-i13233ctrl-i33ctrl-iFctrl-i20112MRS.FLWO.0000Hctrl-i23520287+2102068ctrl-i
Clearly, the ctrl-i is wrongly treated.
I received an other proposal :
set leFichier to (path to desktop as text) & "2mrs_1175_done.txt" set the_path_qUnix to quoted form of POSIX path of (leFichier as text) (* Instruction given by Steve Majewski *) set fixedText to do shell script "tr -s ' ' ' ' <" & the_path_qUnix
which give the wanted result.
Yvan KOENIG (VALLAURIS, France) jeudi 5 janvier 2012 11:59:18
|