Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Right tool for the job' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Right tool for the job
Authored by: Anonymous on Dec 29, '09 12:35:51PM
Please don't use grep with a redirect. Remove blank lines with sed:
sed -i -e "/^$/d" $@
That modifies the original file without a backup. If you really need a backup:
sed -i.original -e "/^$/d" $@
or with an ISO UTC timestamp:
sed -i.$(date --utc +%Y%m%dT%H%MZ) -e "/^$/d" $@
And now, instead of step 5, simply add a second line in your shell script:
open $@
This reduces overhead by not taking an Applescript detour.

[ Reply to This | # ]