Hello I have a text file with about 90,000 lines so I assumed that it would be a good idea to use TextWrangler to sort the lines.
After reading the dictionary, I wrote :
set leDocument to (path to desktop as text) & "essai.txt"
tell application "TextWrangler" activate open leDocument sort lines of text document 1 with sort ignoring leading space and replacing target close text document 1 with saving end tell
My understanding was that the output option [with replacing target] would replace the document contents by the sorted one. Alas it doesn’t.
I replaced my original code by this new one :
set leDocument to (path to desktop as text) & "essai.txt"
tell application "TextWrangler" activate open leDocument sort lines of text document 1 with sort ignoring leading space --and replacing target set text of text document 1 to result close text document 1 with saving end tell
With it, the document contain the sorted lines. It's fine but I'm wondering what is the output option [with replacing target] really doing.
Yvan KOENIG (VALLAURIS, France) dimanche 11 novembre 2012 11:15:41
|