Target every other carriage return
Learn / Forums / General InDesign Topics / Target every other carriage return
- This topic has 6 replies, 3 voices, and was last updated 7 years, 11 months ago by Zach Fonville.
-
AuthorPosts
-
-
May 23, 2016 at 4:50 pm #85119Zach FonvilleMember
I’ve got a huge text file with hundreds of carriage returns. For a very specific reason, I need to target every other, or every nth carriage return.
Nullam quis risus eget urna mollis ornare vel eu leo
Donec ullamcorper nulla non metus auctor fringilla ( ? )
Cras mattis consectetur purus sit amet fermentum
Sed posuere consectetur est at lobortis ( ? )
Curabitur blandit tempus porttitorI’m a noob to grep, but I figure it’s possible. Any thoughts?
-
May 23, 2016 at 9:10 pm #85121Ari SingerMember
There are a number of ways to achieve this, but it really depends on what you plan to with it after that. By that I mean: do you plan on removing, editing or adding text? Or do you want to just change some formatting?
And just to make sure: Are you sure there is no pattern, so for ex. does every other line have something in common which each other?
-
May 24, 2016 at 6:16 am #85132David BlatnerKeymaster
I agree with Ari that more information would be helpful.
In the meantime, this article might help:
https://creativepro.com/find-paragraph-grep.php -
May 24, 2016 at 6:35 am #85133Zach FonvilleMember
Cool, so the lines are all differing lengths, they don’t seem to have any pattern. I am trying to target each other line to remove the paragraph breaks and replace them with standard spaces.
It’s an odd project for a client, who wants the entire text of the bible as a texture on wall panelling. I was able to grep out all the references and numbering easily enough, but the line length is too short for the size of panel—three lines or so would be more appropriate for the texture.
Again, odd project, but the goal would be to strip two of every three paragraph returns out of the entire bible to make line length more conducive to texturing the panel.
most lines end with a period, but not all. If it makes it easier, then it could be a useful shorthand, I would guess, though not perfect.
example text:
And Abimelech charged all his people, saying, He that toucheth this man or his wife shall surely be put to death.
Then Isaac sowed in that land, and received in the same year an hundredfold: and the LORD blessed him.
And the man waxed great, and went forward, and grew until he became very great:
For he had possession of flocks, and possession of herds, and great store of servants: and the Philistines envied him.
For all the wells which his father’s servants had digged in the days of Abraham his father, the Philistines had stopped them, and filled them with earth.
And Abimelech said unto Isaac, Go from us; for thou art much mightier than we.
And Isaac departed thence, and pitched his tent in the valley of Gerar, and dwelt there. -
May 24, 2016 at 7:39 am #85136Ari SingerMember
Try this:
Find What:
(.+)(\r)(.+)(\r)(.+)(\r)
Change To:
$1$2$3$4$5\x{0020}
But beware, this will only work correctly if you change all at once by clicking Change All.
-
May 24, 2016 at 8:06 am #85137Ari SingerMember
I’m sorry please disregard my previous post! I misunderstood what you want. Here is the good code:
Find What:
(.+)(\r)(.+)(\r)(.+)(\r)
Change To:
$1 $3 $5$6
(That’s intentional spaces in there)Note: This will work even if you change it one by one, it does not have to be changed all at once.
-
May 24, 2016 at 8:38 am #85138Zach FonvilleMember
Thanks!
-
-
AuthorPosts
- You must be logged in to reply to this topic.