There's that one blank line between "check_afp.app" and "chess.app". How do I remove that blank line? I've already tried "sed '/^$/d'" but it didn't work.
We speculate that it's a DOS carriage return; if so, you might want to convert the whole file to Unix line ending conventions because otherwise, the problem will continue to haunt you whenever you need to match something at end of line, etc. See if dos2unix or your local equivalent would help (search these forums if you can't find a good command installed locally).
So how do I convert the file to UNIX line endings? And if anyone is wondering where I got the weird space from, it was written to the app by an AppleScript script. I told it to write a "return" to the file, following some text. The return should have put a normal line break in there, which it did, but it certainly is an unmanipulatable break.
Notice, that "^M" is a literal line break: in vi press "<CTRL>-<V>", then hit <ENTER> to enter it. You will notice that it is a single character rather than two chars.
To remove lines which contain any number of whitespace (Tabs and or blanks):
sed '/^[<tab><blank>]*$/d' oldfile > newfile
Enter a literal TAB-char (press <TAB>) and a blank, i just wrote it that way to make it easier to read.
Finally, to find out which unprintable character is bothering you: open the file in vi, enter command mode (press ":") and enter "set list". You will see all the unprintable characters as control codes now (tab characters are represented by "^I" for instance, etc.). Only a blank is now printed as blank char. Enter command mode again and use "set nolist" to switch that off again.