6 Replies Latest reply on Oct 23, 2013 12:55 PM by dunaz

    Grep for removing extra paragraph returns?

    dunaz Level 1

      Hey all you smart people out there. Can I use GREP to remove extra paragraph returns? I'm working on basically a directory, pages and pages of names, addresses, and phone numbers imported from a Word doc. Each line has a style applied,with the first line of each listing being a different style than the others, and a hard paragraph return at the end of each line. There is an extra paragraph return in between each listing. Once I get the styles applied, will GREP allow me to search for the first style in each listing and remove the extra paragraph return in front of it?


      Here's a screen shot. The listings at the top are already formatted, the bottom ones haven't been formatted yet. Basically, I import and apply the style that's most used, and then go in and change the gray bars, and the name/phone. So, I do have to go through the whole thing, but it would still be less clicks overall if I could format everything and then have GREP do the rest.


      Screen Shot 2013-10-22 at 6.54.30 PM.png



        • 1. Re: Grep for removing extra paragraph returns?
          Peter Spier Most Valuable Participant (Moderator)

          There's a pre-built find/change query in the drop down that removes extra returns.

          • 2. Re: Grep for removing extra paragraph returns?
            dunaz Level 1

            Hi Peter. Yes, that works quite effectively. But, is there a way to remove only the extra paragraph returns before a particular paragraph style? I need the extra return before the gray bars. (well, I guess I could change the gray bar style to have space above the bar instead of the return.)

            • 3. Re: Grep for removing extra paragraph returns?

              Yes, take out that extra return before the “gray bar” style and add extra space to the style. Less returns the better and it looks more professional in my opinion.

              • 4. Re: Grep for removing extra paragraph returns?
                dunaz Level 1

                And, by "effective" I mean that it removes all the paragraph returns, not just the ones I don't want. Obviously I'm not doing something right.

                • 5. Re: Grep for removing extra paragraph returns?
                  John Mensinger Adobe Community Professional & MVP

                  Choose "Multiple Return to Single Return" from the Query: menu at the top of the Find/Change dialog.

                  • 6. Re: Grep for removing extra paragraph returns?
                    dunaz Level 1

                    Thanks, John, I'll try that. There are a few more (larger) sections coming that will need cleaning up.


                    I've been doing this project annually for a few years now, need to get better organized with InDe's automation features, which I know will make my life much easier.


                    Sometimes I do some of the cleanup in Word, simple find/changes for double spaces and the like. Their styles are never my styles so I always strip out the Word styles when I place the text, rather than try to match them up on import. Often, the listings come in with a return instead of a tab, grrr. So, the name listing, when it's formatted in InDe, is the person's name/space/right-tab with leader dots/space/phone number (a lot like the White Pages). But in the Word doc, each item is a separate line, and sometimes I have to put everything in the right order so that when I get it into InDe at least all I have to do is delete a paragraph return and then apply a style to the line.


                    I only do one of these a year, so it's not worth it to invest in expensive scripts or extensions. That said, I do need to take better advantage of the built-in features. I'll have to look on Lynda.com for tutorials--I'm sure there are some there.