[TxMt] Re: Help with simple text conversion command

Hans-Jörg Bibiko bibiko at eva.mpg.de
Thu Nov 20 14:49:38 UTC 2008


On 19.11.2008, at 21:55, Nick wrote:

> here's my attempt. just double click the bundle to install. should  
> convert all characters to lowercase then add underscores instead of  
> spaces. I don't know why it's inserting the newline though. if  
> someone knows how to use sed they could make a better command.

Only for the records, I would suggest to use this to avoid printing a  
newline:

/usr/bin/env php -r '
print(strtolower(str_replace(" ", "_", $_ENV["TM_SELECTED_TEXT"])));
'

AND please note that this is not Unicode safe, maybe in PHP 6.0!

--Hans



More information about the textmate mailing list