Jump to content


Photo

how to speed up find/replace in text editor


  • Please log in to reply
7 replies to this topic

#1 mameha

mameha
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 13 October 2006 - 02:20 AM

I am often doing large find/replace commands in Notepad as I convert Excel files before putting into MySQL.  I am replacing tab characters with the | character and it is taking 5 mins per file in Notepad.

Is there another windows program that can do find/replace faster?

#2 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 13 October 2006 - 03:17 AM

winVi or vim for Windows - just be prepared to learn :)

:%s/\t/|/g

Should do the trick once you've got the file loaded.

Or, if you don't feel like learning Vim, you could always get Textpad (www.textpad.com) and do a regex search and replace on \t to |
http://nealylitalo.net - My personal website, and home of The Netizen's Journal.

#3 mameha

mameha
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 13 October 2006 - 03:38 AM

thanks, actually i just realised i can use the \t mark when importing via phpmyadmin instead of | and save myself a lot of time!

#4 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 13 October 2006 - 05:49 AM

Else you could just copy a tab and paste it into the replace field.

#5 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 13 October 2006 - 05:56 AM

Else you could just copy a tab and paste it into the replace field.


The only problem with that is that tabs may be represented differently - I don't believe databases expand \t to 4 spaces or 8 spaces or whatever. I believe they just leave them as \t, and I wouldn't be surprised if the text editor in use would expand the \t to 4 or 8 spaces or whatever it thinks a tab is.
http://nealylitalo.net - My personal website, and home of The Netizen's Journal.

#6 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 13 October 2006 - 02:14 PM

No, but that doesn't matter. A tab is a tab, but in different editors it is presented different. Sometimes it might be 2, 4 or 8 (or user configurable), but a tab is still = \t

But it is much easier to just write \t if the editor support it.

#7 mameha

mameha
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 20 December 2006 - 12:54 AM

Basically I have since found that Wordpad does find/replace much much faster than notepad.

Also, its not necessary to find/replace anyway in this case because you can use \t as the replace character in phpmyadmin.  pasting a tab into there wont work by the way.

#8 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 20 December 2006 - 12:29 PM

Why did you bump a topic that is over two months old?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users