Can't seem to find \n\n to replace

General questions about using WildEdit

Moderators: AmigoJack, helios, bbadmin, Bob Hansen, MudGuard

Post Reply
adaptinc
Posts: 3
Joined: Thu Jan 05, 2006 7:44 pm

Can't seem to find \n\n to replace

Post by adaptinc »

We are having problems doing a replace with WildEdit. After testing different strings, it appears that the problem lies with the \n portion of the code.

We use text pad to convert the code to regular expression by clicking "regular expression" in textpad, pasting in the text, then copying the "converted" text and pasting into the appropriate box at Wildedit. this has worked otherwise. Regardless, I can see all kinds of back to back new lines in the page, but it can't seem to find \n\n.

It will replace some single \n entries, but seems to leave many.

???

Help!
ben_josephs
Posts: 2456
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Have a look at http://www.textpad.info/forum/viewtopic.php?t=7005, in particular, my last message.
adaptinc
Posts: 3
Joined: Thu Jan 05, 2006 7:44 pm

Still not working... thought I had it, but...

Post by adaptinc »

I had a string that would work. I loaded one of the pages as the test file and noticed that in Wildedit, as opposed to in Textpad, it loads as one long set of code, wheras in Textpad it has returns that show in the code.

I then copied the string of code from the display in the text and was able to successfully test replace...

All rights reserved.</font></td> </tr> </table>

with...

All rights reserved.</font></td> </tr> </table> \n\n986787

It worked as a test, with the test file being one of the group being modified, but then when I hit the replace all button not a single item was replaced!

How can it work on the test then fail for the group?
ben_josephs
Posts: 2456
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

The file might not have Windows/DOS line endings (CR,LF). Read the message I linked to.

To convert the file's line endings to Windows/DOS style, open it in TextPad and File | Save As... with File format: PC.
adaptinc
Posts: 3
Joined: Thu Jan 05, 2006 7:44 pm

Any other ideas?

Post by adaptinc »

Actually, I did read the link. In fact, I found it prior to your initial reply. I tried checking and unchecking the literal line break options in every combination I could imagine. None worked.

I noticed that if I copy the contents of a file, paste it into a new doc, then save, all works fine with this new version. However, doing this, or re-saving as a PC version, is VERY cumbersome, as I am working with 58,000 different files, unless you know of a way to do them all at once or to automate the process.

Any other ideas?

If this works in the test mode, but not in the normal mode, is this not a bug?

One final note, the failure is at the end of each of these. Is there a way to simply put text at the very end of a file? I looked for this in help but cannot find it, so I'm guessing the answer is no. However, if there is, this might be my solution here.
ben_josephs
Posts: 2456
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

What sort of line endings do your files have? Open one of them in TextPad, type <Alt-Ret>, look in the Document tab and see what it says next to File type. If it says Unix, the line endings are \n; if it says PC, they're \r\n; if it says Mac, they're \r; if it says Netscape, they're \r\r\n; if it says Unknown, they're mixed up. If they're mixed up you can look at them in detail by opening the file in binary format (line feed = \n = 0A, carriage return = \r = 0D).

In WildEdit try searching for carriage returns and line feeds explicitly. Select Literal line break characters: Linefeed only (Unix) and use the appropriate end-of-line sequence, for example, \r\n or \r?\n or whatever is appropriate.

Is the last line of each file properly terminated with a new line? Observe where the text cursor sits when it's at the end of the file.

Do any of your blank lines contain spaces or tabs? Make them visible with View | Visible Spaces.
Pierce
Posts: 3
Joined: Thu Aug 19, 2010 2:50 am

Post by Pierce »

I was having a similar problem and I was pulling my hair out. As it turns out all the files I was dealing with were of the Unknown. They were initially HTML files that someone had just done a Ren *.html *.txt on.

The command line you want is:

type Unknown.txt | FIND "" /V > PCFormat.txt

This will take your Unknown file and turn it into something that you can actually work with easily in WildEdit. If you have several thousand files you need to convert this way (as I did), just use a .bat file and go get a cup of coffee.
Post Reply