1

I am looking for a grep expression for InDesign.

I have the following lines:

This is Line 1
This is Line 2
This is Line 3
This is Line 4
This is Line 5
This is Line 6

Line 1 and 2 will be right indent.
Line 3 and 4 will be left indent.
Line 5 and 6 will again be right indent.

There is a carriage return after each line, except line six. I want to target the carriage return after line 2, 4 and replace it with some other character or forced linebreak. How can I do that in grep?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Shahid
  • 65
  • 6
  • Do you really mean carriage return or do you mean line feed or both? Please [edit] your question to show the output of `cat -Ev file` when tun on your input file so we can see the carriage return and/or line feed characters – Ed Morton Jul 19 '21 at 14:39
  • ("grep InDesign" - *"InDesign's built-in grep function."*) – Peter Mortensen May 30 '22 at 13:43

1 Answers1

0

Find what: (.+\r.+)\r

Change to: $1#

where # is your symbol.

Yuri Khristich
  • 13,448
  • 2
  • 8
  • 23