Hi,
if every line break you’d like to remove would be on a line with reliably
more than 35 characters this would be easy. You could search for:
^(.{35,})\n
and replace it with \1
Unfortunately, regular expressions (as I understand it) can’t match „1 to
35 characters, but only if there are no more than 35 characters on that
line“ (that would indeed be a job for sed)
If every paragraph would have two line breaks (an empty line between two
paragraphs) AND each paragraph line started with a character you could
search for a line break followed by a non-space character:
\n(\S)
and, again, replace that with \1
If paragraphs are not separated by empty lines I’d doubt that there is an
easy way to tell a grep pattern the difference between a „legit“ and an
„unwanted“ line break.
Roland
On Mon, Oct 9, 2017 at 3:56 PM, Mark C. <[email protected]> wrote:
> So I'm cleaning up a text file that was converted from a PDF file. One of
> the problems is that each line break is a hard return.
>
> I'd like to replace those hard returns.
>
> However, at the end of each paragraph, there is also a hard return, so
> replacing the hard returns will remove all paragraph formatting.
>
> However, the last line in each paragraph is never longer than 35
> characters.
>
> Is there a way within BBedit to search for [space] [hard return] [any
> sentence<35 characters [space] [hard return] and remove that 2nd hard
> return?
>
> I'm guessing I'll have to learn Sed to accomplish this, but thought I
> would ask here first. Thank you.
>
> --
> This is the BBEdit Talk public discussion group. If you have a
> feature request or would like to report a problem, please email
> "[email protected]" rather than posting to the group.
> Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
> ---
> You received this message because you are subscribed to the Google Groups
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/bbedit.
>
--
This is the BBEdit Talk public discussion group. If you have a
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.