Hey, I can also remove any lines containing tabs and line breaks
(which the previous script did not do), by using combinations of \t
and \r
I think I got a little out of step with the script below, so it is
possibly longer than necessary. But seems to work O.K, whist still
keeping the original tab spacing;
tell application "TextWrangler"
activate
replace "\\r\\r" using "\\r" searching in text 1 of text document 1
options {search mode:literal, starting at top:true, wrap around:false,
backwards:false, case sensitive:false, match words:false, extend
selection:false}
replace "\\t\\r" using "" searching in text 1 of text document 1
options {search mode:literal, starting at top:true, wrap around:false,
backwards:false, case sensitive:false, match words:false, extend
selection:false}
replace "\\t\\t\\r" using "" searching in text 1 of text document 1
options {search mode:literal, starting at top:true, wrap around:false,
backwards:false, case sensitive:false, match words:false, extend
selection:false}
replace "\\t\\t\\t\\t" using "\\t\\t" searching in text 1 of text
document 1 options {search mode:literal, starting at top:true, wrap
around:false, backwards:false, case sensitive:false, match
words:false, extend selection:false}
replace "\\t\\t\\t" using "\\t\\t" searching in text 1 of text
document 1 options {search mode:literal, starting at top:true, wrap
around:false, backwards:false, case sensitive:false, match
words:false, extend selection:false}
replace "\\r\\r" using "\\r" searching in text 1 of text document 1
options {search mode:literal, starting at top:true, wrap around:false,
backwards:false, case sensitive:false, match words:false, extend
selection:false}
replace "\\t\\r" using "" searching in text 1 of text document 1
options {search mode:literal, starting at top:true, wrap around:false,
backwards:false, case sensitive:false, match words:false, extend
selection:false}
replace "\\t\\t\\r" using "" searching in text 1 of text document 1
options {search mode:literal, starting at top:true, wrap around:false,
backwards:false, case sensitive:false, match words:false, extend
selection:false}
replace "\\t\\t\\t\\t" using "\\t\\t" searching in text 1 of text
document 1 options {search mode:literal, starting at top:true, wrap
around:false, backwards:false, case sensitive:false, match
words:false, extend selection:false}
replace "\\t\\t\\t" using "\\t\\t" searching in text 1 of text
document 1 options {search mode:literal, starting at top:true, wrap
around:false, backwards:false, case sensitive:false, match
words:false, extend selection:false}
end tell
Cheers,
David