homepage Welcome to WebmasterWorld Guest from 184.72.72.182
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / WYSIWYG and Text Code Editors
Forum Library, Charter, Moderator: open

WYSIWYG and Text Code Editors Forum

    
Multi-line Find & Replace
What's the right text editor for this?
Mike Goldmine




msg:3547144
 2:55 pm on Jan 13, 2008 (gmt 0)

I've been looking for a text editor that manages to change multiple lines at the same time for about 10 hours now without being successful. I've searched through this forum, Google, this forum, asked people, Google, this forum...

What I want to be able to do is to edit lines in folder's files (sub-directories included). I've tried following editors and nothing seems to work:

TextPad
UltraEdit
EditPad Pro
TextWiz
Crimson Editor
AceHTML
NVU
Frontpage 2002

This is an example of what seems to be an impossible task:

<a href="http://www.webmasterworld.com/">WB WORLD</a><br>
<a href="http://www.webmasterworld.com/home.htm">WB WORLD FORUMS</a>

That would be in my navigation. Now, if I want to replace that with two different URLs at the same time, delete or replace with one or more lines at the same time - this seems to be impossible?

I'm not even able to paste two lines to the "find" field in most of those editors, but even if I would be able, it still only searches the first line.

Any help appreciated!

 

ytswy




msg:3547171
 3:27 pm on Jan 13, 2008 (gmt 0)

Dreamweaver has a decent search and replace function which lets you include line endings. Also Microsoft Word uses ^p to search/replace line endings.

You might want to read up on Regular Expressions however, if you want to do complex search and replaces that's where it's at and you souldn't have any problems finding a text editor that supports them.

The Contractor




msg:3547215
 4:52 pm on Jan 13, 2008 (gmt 0)

Check out software like "Search and Replace". I do NOT know of any tool that will allow you to replace one string/line that may be somewhere in the code and then replace another string/line that may be somewhere else in the code (not adjacent) all at the same time. Like I say, the software Search and Replace (Funduc Software) is the tool I use. It's very powerful and can search any type of file you want it to. It supports Reg Expressions also.

[edited by: The_Contractor at 4:53 pm (utc) on Jan. 13, 2008]

steve40




msg:3547224
 5:04 pm on Jan 13, 2008 (gmt 0)

AFR does a great job of that

Mike Goldmine




msg:3547306
 8:11 pm on Jan 13, 2008 (gmt 0)

Thanks for help everyone!

Steve40, what kind of a command do you use to change two lines at the same time? AFR worked just like the rest of them - I can only paste one line at a time and therefore not change more than that...

steve40




msg:3547319
 8:58 pm on Jan 13, 2008 (gmt 0)

<a href="widget1.html" >Widget 1</a> <br> <br>
<a href="widget2.html" >Widget 2</a> <br> <br>
<a href="widget3.html" >Widget 3</a> <br> <br>
<a href="widget4.html" >Widget 4 </a> <br> <br>

with

<a href="lotsofwidget1.html" >Widget 1</a> <br> <br>
<a href="widget2.html" >Widget 2</a> <br> <br>
<a href="lotsofwidget3.html" >Widget 3</a> <br> <br>
<a href="widget4.html" >Widget 4 </a> <br> <br>

or anything else

singe command across full site html files or whatever

very quick very efficient but also powerful enough to be dangerous so be careful until confident with

steve

Mike Goldmine




msg:3547326
 9:29 pm on Jan 13, 2008 (gmt 0)

Steve40,

Thank you so much! Works now!

[edited by: engine at 12:48 pm (utc) on Jan. 14, 2008]

The Contractor




msg:3547638
 11:46 am on Jan 14, 2008 (gmt 0)

<a href="widget1.html" >Widget 1</a> <br> <br>
<a href="widget2.html" >Widget 2</a> <br> <br>
<a href="widget3.html" >Widget 3</a> <br> <br>
<a href="widget4.html" >Widget 4 </a> <br> <br>

with

<a href="lotsofwidget1.html" >Widget 1</a> <br> <br>
<a href="widget2.html" >Widget 2</a> <br> <br>
<a href="lotsofwidget3.html" >Widget 3</a> <br> <br>
<a href="widget4.html" >Widget 4 </a> <br> <br>

Well yes Search and Replace can do that...heh..heh

coopster




msg:3547902
 5:22 pm on Jan 14, 2008 (gmt 0)

The Eclipse IDE has an awesome Search/Replace feature set. Not only can you customize the interface to search through directories and files, but you can also search projects, workspace, tasks, logs, remote etc.

You can do case-sensitive and/or regular expressions on both the search strings as well as the filenames.

Lastly, you can do a find/replace without interactive intervention, or you can edit files one-by-one.

There is also a restore from local history feature that comes in handy once in awhile.

thealexangroup




msg:3553070
 7:50 pm on Jan 20, 2008 (gmt 0)

to steve40,

will AFR be able to search/replace one line of code for a multi-lined code? example below:

replace this: <!--siteid="123"; sitename...one-lined string...//-->

with this:

<script type="text/javascript">
<!--
naa_siteid="12345678"; naa_sitename="example.com"; naa_test="no";
//-->
</script>
<script type="text/javascript" src="http://aa.somedomainname.com/naa_1x1.js"></script>

in order for code to work it cannot be on a one lined string.
" <!-- " AND " //--> " have to be on their own line.

thanx,

alx

[edited by: tedster at 8:06 pm (utc) on Jan. 20, 2008]
[edit reason] use example.com [/edit]

steve40




msg:3553119
 10:04 pm on Jan 20, 2008 (gmt 0)

thealexangroup

Yes works as per your needs , I always have confirm replace turned on and run the first 2 as manual to check it gives the result I want then if all ok say yes to replace all

The only issue I have is THERE IS NO UNDO changes so in the beginning I tend to back up site prior to mass changes

It is worth noting the only problem I have ever had is application freezing when I used on a 20,000 page site due to memory leakage , but of all the apps I have purchased over the years I would say AFR has been one of the big time savers

steve

phranque




msg:3553257
 2:30 am on Jan 21, 2008 (gmt 0)

welcome to WebmasterWorld [webmasterworld.com], Mike_Goldmine!

thealexangroup




msg:3553839
 7:21 pm on Jan 21, 2008 (gmt 0)

to steve40 (followup):

thanx for reply. at 20k freeze up? uh-oh. what did you do after that happened? were you able to pinpoint at what point it froze so as to continue? i'm guessing you F & R 'ed files in segments after that?

i ask because i am probably going to do roughly 200k files.

thanx,

alx

steve40




msg:3553864
 7:52 pm on Jan 21, 2008 (gmt 0)

thealexangroup

It did not freeze up every time and on one site with 40K pages was fine , but thought you should know about the bug incase you come across it.

It is quite easy to work out where it hangs I just hit alt ctr del to end process and by checking on time file changed just a bit of a pain plus can just use find

but 40k of files just couple of seconds to afr so saves hours

of all the stuff I use my diamonds are AFR and Zenu

hope that helps
steve

varya




msg:3553887
 8:23 pm on Jan 21, 2008 (gmt 0)

I use Editpad Pro and it handles multi-line search and replace just fine.

I've done global search and replace operations with extensive chunks of code...50 lines or more and it handled it just fine.

thealexangroup




msg:3560138
 11:43 pm on Jan 28, 2008 (gmt 0)

To Steve40
RE: post #:3553070 January 20th?

hey steve,

i got afr but in need of advice. problem was i couldn't get my script to replace as is (as in, multiple line) so i contacted afr's roman. he told me to uncheck (at "replace" options) "delete trailing CRLFs" for it to work.
when i do that afr ceases to work. (doesn't recognize file) when i re-check "delete trailing..." afr works, although script shows as one continuous line. tried to private message roman again but must be busy.

i'm thinking i should have something check marked or not check marked but don't know what. right now, the only thing i changed from default was i unchecked "replace in MS Office" and checkmarked "save as unix files"
(also checkmarked "confirm before action...)

also, i don't know which is better to use (when it does work) replace, replace with OR replace, insert before/after

any thoughts,

alx

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / WYSIWYG and Text Code Editors
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved