End of Line string

General discussions about Advanced Find and Replace
Post Reply
JohnA
Posts: 3
Joined: Mon Jan 31, 2005 5:32 pm

End of Line string

Post by JohnA »

I have some files with various line terminations of typically \x0d\x0a\x0d (CR,LF,CR) which need changing to \x0d\x0a (CR,LF). I have tried several things but only have success if I replace the original string to say "EOB" then run AFR again to replace "EOB" to the required \x0d\x0a string.
I also need to add one new character to the top of the file and one to the end.
Can anyone help please?

JohnA
Posts: 3
Joined: Mon Jan 31, 2005 5:32 pm

Post by JohnA »

Ok, I sorted the CR,LF thing - but how can I add characters at top and bottom of files?

JohnA
Posts: 3
Joined: Mon Jan 31, 2005 5:32 pm

Post by JohnA »

Here I go again!
Now got the character at the top of files ok using Find \A and replace with \r"character".
This will not work at the end though using find \Z and replace with \r"character".
Can anyone give me the answer?

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Hi,

First of all:
\x0d\x0a\x0d (CR,LF,CR) will be in regular expressions:
\r\n\r

So if you have different combinations, we advise you to use one line
in Batch grid for each pair of variants.


Secondly here is a solution that works for inserting chars at the top
and at the bottom of files:

Search for:
\A(.*)\Z

Replace with:
toptext$1bottomtext

So $1 will represent whole old content of the file.
toptext and bottomtext - are your texts you want to insert.

Very important to put correct modifiers:
Modifier S = ON
Modifier M = ON
Modifier I = ON
Modifier G = ON

We verifies these examples they perfectly work.

Post Reply