Filter PC/Mac line endings from pasteboard data
Apr 04, '05 09:57:00AM
Contributed by: cbt
Here's a handy alias for your profile:
alias pbpaste="pbpaste | perl -pe 's/\r\n|\r/\n/g'"
It guarantees that any output from pbpaste will have Unix line endings.
[robg adds: Some people (myself included) don't like to overwrite the built-in commands with their own aliases. If that's the case for you, too, just change the word after alias to whatever you'd like to call the new command. To make this new command permanent, include it in your .bash_profile file in your user's home directory. An earlier hint discusses Unix vs. Mac line breaks, and explains how the above Perl script works.]
Comments (4)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20050401120229491