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


Click here to return to the 'Filter PC/Mac line endings from pasteboard data' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Filter PC/Mac line endings from pasteboard data
Authored by: lugal on Apr 04, '05 10:49:31AM

Very nice. I'd been using something similar (w/ tr instead of perl) to convert Mac line endings to Unix, but this is more powerful. WRT Rob's comment about overwriting "pbpaste," you could try using the following:

alias pbconvert="pbpaste | perl -pe 's/\r\n|\r/\n/g' | pbcopy"

This simply replaces the contents of the clipboard w/ the cleaned up text. You can then paste the cleaned up text with Command-V or "pbpaste." I've been doing this, with my old version of the alias, for quite a while, and it's been really useful.



[ Reply to This | # ]