Comments on: A Reference for the VI Text Editor (aka VIM) http://tipsfor.us/2009/01/14/a-reference-for-the-vi-text-editor-aka-vim/ Tech Tips, Reviews, Tutorials, Occasional Rants Sat, 31 Aug 2013 15:50:35 +0000 hourly 1 https://wordpress.org/?v=4.8 By: Everett - TipsFor.us http://tipsfor.us/2009/01/14/a-reference-for-the-vi-text-editor-aka-vim/#comment-5832 Thu, 12 Nov 2009 22:58:34 +0000 http://www.tipsfor.us/?p=1643#comment-5832 Here’s a handy regular expression. Say you want to find and replace all instances of Oracle timestamps to MySQL timestamps?

to_timestamp(’11-NOV-09 12.40.47.000000000 PM’,’DD-MON-RR HH.MI.SS.FF AM’)

Should become
NOW()

A simple find an replace won’t cut it because there could be ANY date and time in the target string, and normal greedy matching will replace more than you want. Instead use non-greedy matching:
:%s/to_timestamp(.\{-})/NOW()/g

]]>
By: Everett - TipsFor.us http://tipsfor.us/2009/01/14/a-reference-for-the-vi-text-editor-aka-vim/#comment-4919 Fri, 16 Jan 2009 19:23:01 +0000 http://www.tipsfor.us/?p=1643#comment-4919 My pleasure! Feel free to share any of your own tips or point out any errors!

]]>
By: GearNoggin http://tipsfor.us/2009/01/14/a-reference-for-the-vi-text-editor-aka-vim/#comment-4916 Thu, 15 Jan 2009 22:07:47 +0000 http://www.tipsfor.us/?p=1643#comment-4916 Great summary. Thanks!

]]>