[macvoiceover] Script to remove blank lines

Hi all,
Below is a apple script that I wrote to remove blank lines in txt and rtf files. The file that you want to remove the blank lines from must be on the desktop. The script will change the extension of the original file to bak.

set title to "File to strip blank lines from"
set fn to ""
display dialog title default answer the fn
copy the result as list to {the fn, the b}
set extension to last word of fn
if extension is not "txt" and extension is not "rtf" then
        set title to extension & " is not a valid extension"
        display dialog title
        return
end if
set firstName to first word of fn
set bf to firstName & ".bak"

set ss to "sed '/^$/d' ~/Desktop/" & fn & " > ~/foo"
do shell script ss
set ss to "mv ~/Desktop/" & fn & " ~/Desktop/" & bf & ""
do shell script ss
set ss to "mv ~/foo ~/Desktop/" & fn & ""
do shell script ss




Richard Most
louie@xxxxxxxxxxxxxxxxx




Click on the link below to go to our homepage.
http://www.icanworkthisthing.com

Manage your subscription by using the web interface on the link below.
http://www.freelists.org/list/macvoiceover

Users can subscribe to this list by sending email to macvoiceover-request@xxxxxxxxxxxxx with 'subscribe' in the Subject field OR by logging into the Web interface at http://www.freelists.org/list/macvoiceover

Other related posts: