Grep for removing extra paragraph returns?

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.
Thanks!

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.

Similar Messages

  • Is there a way to remove extra hard returns without wrecking text?

    Hey gang,
    I have 300 pages of flowing text that arrived via Import XML. Here and there are groups of 2 or 3 empty hard returns littering the flow. I want to Find/Change to get rid of them.
    If I GREP search for \r (even adding negative lookaheads and negative lookarounds for the purpose of isolating empty returns) and replace them with nothing, this gives rise to a problem of the NEXT paragraph gets its paragraph style changed.
    How can I avoid changing the paragraph style of the text that follows the empty returns?
    Mike Witherell in Maryland

    Michael Witherell wrote:
    No, both these methods cause the next legitimate text to change paragraph style.
    Not at all!
    1 click!
    Done! 

  • Extra Paragraph in Table of Contents

    I have a TOC set up in a three-column text frame, and have it set to balance columns. When I generate the TOC, it gives me an extra paragraph return at the end, which messes up the column balance. ny way of fixing this?

    I notice that too... Do you know if there's any fix (or work around) for that?

  • How to remove a hard return

    What is the command for removing a hard return? I want to know how to remove a hard return in a document or an email (I’ve tried both Word and my email). I'm new to Mac but on my PC I usually just put the cursor to the right of the last letter on the line and hit delete and the line below gets moved up but in the MAC when I do that all it does is delete the letters in the word to the left of the cursor.
    Thanks.

    After playing with this idea it looks like the solution is to put the cursor in front of the first word on the line you want to move to the line above it and then hit delete. Just hitting enter/return adds another hard return.
    Thanks!

  • Grep Removing Characters when searching for Paragraph returns

    I'm currently working on an xml based business card file and the formatting requires me to search for a phone number followed by a End of Paragraph followed by a Page Break and then remove the unnecessary Paragraph Return. For some reason inDesign will not find an End of Paragraph then a Page Break through the following grep code "\r~P", however if I search for "\r\r" it will find it. I have been able to get this to work with "(\d{3}\.\d{3}.\d{4})\r\r" and then change to "$1~P", but each subsequent business card loses one number off of the end (804.777.7777, 804.777.777, 804.777.77 etc). What would cause this?
    Thank you,
    Brandon Boswell

    You should move this over to scripting (http://forums.adobe.com/community/indesign/indesign_scripting). You'll find people over there who can give you more help, if there is any.

  • GREP for changing paragraph style?

    Okay folks, I have another one for all you smart people out there. I think GREP can be used to change formatting in the following instance, but I have no idea how to set it up.
    I have a very long document, essentially a phone book-type listing of names, phone numbers, addresses, well over 150 pages' worth. The paragraph styles are fairly simple, only two per listing. The name/phone number is bold with a right hand tab with leader dots to a phone number that is flush to the right side of the column. The following lines are flush left, not bold, but indented 6pts. I've placed the text file and assigned the entire thing the NameListing paragraph style. I'd like to use GREP to find the address lines and change them to the NameListingAddress paragraph style.
    Here's a screen shot to give you an idea. The left column is formatted correctly with both styles, the right column is "raw", all paragraphs formatted with the NameListing paragraph style.
    Is this an appropriate application for GREP? If so, how do I set it up to only change the paragraphs that "don't have tabs"? It would save me a crapload of time.
    THANKS again! --Dina

    If your intent here is to use the character style to trigger a variable, as I belive it is based on your other thread, you MUST apply the character style up to the first tab to pick up the text at the start of the paragraph. There are two approaches to automating the formatting after that, but it may be too late for you to be much help.
    In cases where every listing has the same number of lines it makes sense to use a unique paragraph style name (not necessarily format -- base on on another) for each lline and make it its own paragraph. Set up "next styles" to rotate through the list so each line is assigned the correct style based on the style of its predecessor. You get the rotation to sart over by making the first line style the next style for the last line. This works for manual entry and can be applied to an entire block of placed text in a single operation by selecting the text, then right-clicking the name of the first style to be applied and choose Apply <stylename>, Then Next Style.This ONLY works if you have exactly the same number of paragraphs in each listing.
    The other option is to use forced line breaks instread of paragraphs and use one style for the entire listing. Set a left indent and negative first line indent, create a character style for the part of the first line that you want to appear in your header and apply it Up To ^t^n (that's a little-known trick -- if you enter more than one character in the trigger for a nested style it will activate on the first instance of any of the characters listed that occurs, so for example if you enter the word cat, your style will end on the first, c, a or t that appears inthe paragraph. ^t is the metacharacter for tab, and ^n is for forced line break) so that the style will end at either the tab, if present, or the forced line break if there is no tab (if you use a right-indent tab instead of a regualr right aligned tab [tricky to do a leader, but that's another discussion] substitute ^y for the ^t), then add a nested Line Style for one line. That line style should use a second character style that is based on the first character style you created for the name text and has no other attributes if you want the line to be the same from end to end. Sounds more complex than it is, and will work for listings with variable lenghths. The trick is to repalce your paragraph returns with forced line breaks, and will require a little thinking.
    If using separate paragraph styles for each line, you'd use the same technique of a nested style up to a tab for the first line, but there is no need to get fancier since it will apply to the whole line if there is no tab. The paragraph style, in this case, would carry all of the bold and size formatting (and no need for any indents), and the character style would be nothing more than a name that will allow you to use it in the variable.

  • How do I remove extra space between paragraphs

    I'm writing a research paper, and between paragraphs an extra line of space is added.  My professor isn't happy about this.  Help me eliminate the space.

    The default after paragraph spacing in Pages is 12 points. With a 12 point font, this puts a whole line-worth of space after each paragraph return. It is very easy to change this in the text inspector.
    If you don't want to have to remember to change it each time you open a new blank word processing document, create your own template. Open the blank template & set up your document with the line spacing, margins, headers, etc. as you'd like. Redefine all of the paragraph & character styles to have your desired font. You can set default wrap for any object as well as many other settings. Insert a table, click in it & choose the font, size, color, etc. you want in the fonts panel or format bar. You can do similar changes to inserted objects & text boxes. While you're at it resize the box if you want, set the amount of extra space in the wrap inspector, etc. Delete each text box, object & table after you've set them.
    Now, save this document as a template & select that template as default in preferences. If you decide to make any changes to the template down the road, just Save As Template again with the same name & replace the previous version. All of your new documents will have these settings for inserted objects, images & tables. Unfortunately, the settings won't apply to any other templates or "foreign" documents you open with Pages.

  • GREP style for one specific paragraph

    Hi all,
    I'm faced with the following problem in a textdocument I've got to rework in InDesign.
    The text is based on 3 'groups' of information. First there is a title, beginning with:
    "1.1. Title (so two digits and a paragraph),
    a body text,
    and a source, starting with: 'source: This is the source' and
    '*: this is the source'.
    Now I want all paragraphs starting with two digits in the same style, and all lines starting with 'Source' or '*' in the same style.
    I'm pretty new with GREP, but I believe that might be the solution. Or any other ideas to to this fast and automated?
    Is there a code that specifies a style for a whole paragraph?
    All help is very much appreciated since this is a very laaaarge document.
    Thanks!

    GREP styles (which you seem to think of) only apply character styles. So that's out for entire paragraphs.
    woutergeeftvorm wrote:
    Now I want all paragraphs starting with two digits in the same style, and all lines starting with 'Source' or '*' in the same style.
    Select all text and assign it your Body text paragraph style. Then use this in the Find/Replace dialog, GREP section. Find:
    ^\d+\.\d+
    Replace: leave blank, but select the name of the title style in the Change To formatting fiend.
    Press Change All. Done.

  • Removing extra text after a certain point for a field

    Post Author: ralph.devlin
    CA Forum: Formula
    Hello,
    What we want to do is remove extra text, IE (PO12345.195) We would want to remove the .195 from the end of that data so that the groupings will group them correctly. How can I accomplish this. The defaul trim commands seem to only elimnate white space, I want to elimnate text up to a certain point. thanks
    Ralph

    Post Author: Charliy
    CA Forum: Formula
    You want to do an INSTR to locate the period, then a LEFT to only show the data before it.  Something like:
    IF INSTR({table.field},".") > 0 THEN LEFT({table.field},(INSTR({table.field},".") )-1) ELSE {table.field}
    I subtracted 1 because in your example above the period is in position 8 and you want the first 7 characters.

  • Removing extra spaces from a long document

    Hello
    I have seen a number of find/change and GREP formulas to do similar things. I have NO scripting or coding experience and have labored to understand GREP.
    So I am a little afraid to use it as I don't know what all the modifiers refer to (I do have a printout of some neat GREP cheatsheets like Mike Witherell's that I can absorb until I obtain a good reference )
    I need something I can copy and paste into either find/change or GREP dialog that will do the following in less than 12 steps (hopefully) without doing something catastrophic like removing all of my paragraph marks (which I almost did using someones GREP expression)
    No spaces before any comma, period, exclamation mark, question mark, colon, semicolon
    One space only after any of those
    One Space before any opening parenthesis and one space after the closing parenthesis
    No space after the opening parenthesis or before the closing parenthesis
    Remove any double or extra spaces ( en, em etc.)
    Remove any commas before parentheses
    Remove any spaces after a paragraph mark
    I think that's it
    I did find this one recently (Maybe Jongware?)
    [~m~>~f~|~S~s<~/~,~3~4%]{2
    Which from my dim understanding addresses em, en, flush and hair space ,  nonbreaking space ,figure space,third space--not sure of the rest. Really this is way over my head.
    I know this will be a piece of cake for you guys
    Thanks

A: Removing extra spaces from a long document

Peter is too modest, he's doing just great.
No space BEFORE-One Space after ---period,semicolon,colon, exclamation, question mark,CLOSING Parenth,Bracket,Brace, single & Dbl. quotation marks
Find (\s)([.,;:!\)\]\}~}~]])
Replace with $2
No space AFTER-One Space Before----OPENING bracket,brace,parenthesis,Dbl & single quotes
Find ([\[\{\(~{~[])(\s)
Replace with $1
These remove the space before/after but do not automatically add a space after/before.
In the first case, you could add a space right after the '$2' in the Replace With string, but it already may have a space, in which case you suddenly have two. One alternative is to optionally remove it with the Find string (add it as an optional match) and always add it with the Replace string, but remember that this string will only be found if there is a space preceding it. That way you'd only check the space after in cases where there was a bad space before.
So I propose you add another two find/changes to add the space, only when necessary.
One Space After: find
([.,;:!\)\]\}~}~]])(?!\s)
replace:
$0 [followed by one single space]
One Space Before: find
(?<!\s)([\[\{\(~{~[])
replace:
[one single space] $0
Color-coding with my WhatTheGrep might make it just a tad clearer what's going on in that jumble of codes:
(1 [ .,;:! \) \] \} ~} ~] ] 1) (?!! \s !)
and
(?<!<! \s <!) (1 [ \[ \{ \( ~{ ~[ ] 1)
(Orange is lookahead/lookbehind, blue is a regular escaped character, pink is an InDesign special character, green is normal grouping parentheses, and lavender is a character group.)

Peter is too modest, he's doing just great.
No space BEFORE-One Space after ---period,semicolon,colon, exclamation, question mark,CLOSING Parenth,Bracket,Brace, single & Dbl. quotation marks
Find (\s)([.,;:!\)\]\}~}~]])
Replace with $2
No space AFTER-One Space Before----OPENING bracket,brace,parenthesis,Dbl & single quotes
Find ([\[\{\(~{~[])(\s)
Replace with $1
These remove the space before/after but do not automatically add a space after/before.
In the first case, you could add a space right after the '$2' in the Replace With string, but it already may have a space, in which case you suddenly have two. One alternative is to optionally remove it with the Find string (add it as an optional match) and always add it with the Replace string, but remember that this string will only be found if there is a space preceding it. That way you'd only check the space after in cases where there was a bad space before.
So I propose you add another two find/changes to add the space, only when necessary.
One Space After: find
([.,;:!\)\]\}~}~]])(?!\s)
replace:
$0 [followed by one single space]
One Space Before: find
(?<!\s)([\[\{\(~{~[])
replace:
[one single space] $0
Color-coding with my WhatTheGrep might make it just a tad clearer what's going on in that jumble of codes:
(1 [ .,;:! \) \] \} ~} ~] ] 1) (?!! \s !)
and
(?<!<! \s <!) (1 [ \[ \{ \( ~{ ~[ ] 1)
(Orange is lookahead/lookbehind, blue is a regular escaped character, pink is an InDesign special character, green is normal grouping parentheses, and lavender is a character group.)

  • Extra carriage returns in footnotes of exported RTF

    All documents containing footnotes in Indesign are exported with extra hard returns after each footnote when exporting to Word .rtf.
    I am using Indesign CS5 but this has always been the case since earlier versions of Indesign.
    Does anyone know a way to avoid this or of a way to fix it afterwards in Word. Search end replace for double paragraph marks in Word doesn't seem to be working in footnotes.

    The email is formatted poorly by the sender.
    The screen width for a PC is min 640x480, which is large enough to display the email with the extar carriage returns on every line.
    The  Blackberry has a much smaller resolution, even with smaller text (which you could try but I wouldn't count on).
    The BB removes extra CR/LF's (ie if you have three or four per line, it will only show one), but it isnt going to reformat the entire email.
    Especially since the email is generally formatted for a reason.
    The sender has not formatted the email (thatws an auto-reply email, right?) for small screens or mobile devices.
    If you open the email in outlook and then reduce the window size to 1/4 or smaller than you will see the exact same thing on the Outlook email...
    So, there is nothing you can do on the BB. Its the sender who needs to change their emails.
    Checked out my Blackberry FAQ's and Links to Needed Articles here
    http://darkeen.homelinux.com/index.php/Blackberryfaq

  • [JS, CS3] How to find text that is NOT a paragraph return

    Hi all,
    This is probably an easy one, but I can't seem to get the idea. I want to search within some text and find everything EXCEPT the paragraph return. What would be the way to build that expression? Thanks for any response.
    Regards,
    Len Swierski

    Thanks, Peter!
    I appreciate your help but I have found another solution. I am amazed at my own stupidity sometimes. You see, I do my scripting in a very lame sort of way because I have never used Javascript outside of InDesign. As such, I find myself at a disadvantage because the documentation that Adobe provides assumes that you are aware of many of the basics. Case in point: I have always had trouble manipulating strings because I NEVER KNEW that you could search and replace strings! I just could not find examples of this in the Adobe documentation. So here I was in some cases adding temporary textFrames so I could get to my strings as text contents and then removing the temporary textFrames at the end of the script. In this particular case I needed to merge several paragraphs into one paragraph. Now that I know how to search & replace strings, it is so simple to strip away all the paragraph returns (which are included in text contents). I am learning, albeit rather slowly. Thanks again.
    Regards,
    Len Swierski

  • Paragraph Return in Imported Data

    Hello all,
    I am currently using the Data Merge functions of ID CS4 to import some data I have exported from a MySQL database. Although I can set ID to remove blank lines, this doesn't always work for my purpose because later lines contain data. As a result, there still appears whitespace in the outputted data.
    Since I am using PHP to produce the CSV file, my question is this: is it possible for me to indicate an InDesign Paragraph Return character within the CSV file, so that the data can then in turn be imported and displayed as I wish.
    For example, I have the tried the following examples, but nothing seems to work:
    "code","description"
    "12345", "Hardware\nTools"
    "code","description"
    "12345","Hardware \Z  Tools"
    Any help would be gratefully appreciated.
    Regards,
    Ben.

    In a .csv file a paragraph return indicates a new record and there is no real facility for a force line break. You probably just want to add another field, but if you really think the second line must be part of the same paragraph, you can add a unique marker of some sort, then do a find/change to replace with a forced line break.

  • Remove extra space value of the field  in text element

    Dear All,
    Can any one please help me out to remove the blank spaces in the text elements of SF.
    we are printing Label in which i want print  quantity of material. and i am using MSEG-MENGE for quantity of maetrial.
    But the issues is when we are printing the label. We are getting spaces  in the Text elements fields &MSEG-MENGE&.
    i am also check menge field within mseg table. in which menge field define as QUAN data type with length 13.
    <
    MAT CODE:&t_MSEG-MATNR&
    DESC:&MAKTX&
    QTY:&t_MSEG-MENGE&          
    UOM:&t_MSEG-MEINS&
    >
    My Output in SF:
    MAT CODE:11000002
    DESC:Coarse Aggregate 10mm Sieve
    QTY:             960
    UOM:LBM
    MIGO.NO.:4900000025
    how to remove extra blank spaces in the text elements ( QTY:             960 )
    guide me.........

    Dear All,
    I am using  code block in SF before text element.
    In  The Text Element ...
    <
    MAT CODE:&t_MSEG-MATNR&
    DESC:&MAKTX&
    QTY:&t_MSEG-MENGE&
    UOM:&t_MSEG-MEINS&
    MIGO.NO.:&t_MSEG-MBLNR&
    PO.NO.:&t_MSEG-EBELN&
    LOCATION:&t_MSEG-WERK&&NAME1&
    >
    In programe Line ( code block )....
    <
    read table t_mseg index w_index.
    qty = t_mseg-menge.
    condense qty.
    SELECT SINGLE name1 FROM t001w INTO name1 WHERE werks = t_mseg-werks.
    SELECT SINGLE maktx FROM makt INTO maktx WHERE matnr = t_mseg-matnr.
    >
    My Output:
    MAT CODE:11000002
    DESC:Coarse Aggregate 10mm Sieve
    QTY:                                                      960
    UOM:LBM
    MIGO.NO.:4900000025
    Only problem in value of Quantity field .
    guide me.........

  • Linked Server :: OLE DB provider "OraOLEDB.Oracle" for linked server "ABC" returned message "New transaction cannot enlist in the specified transaction coordinator. ".

    Hello All,
    As mentioned in title, i am stuck up with that articular error from last three days,
    i have following scenario, my SQL server 2008, my oracle 10g are on both same machine with OS Windows Server 2008.
    the following error generated on my management studio when i execute my procedure written in my SQL server. Following is original source code snippet after error massage.
    OLE DB provider "OraOLEDB.Oracle" for linked server "ORCL" returned message "New transaction cannot enlist in the specified transaction coordinator. ".
    Msg 50000, Level 16, State 2, Procedure PROC_MIGRATE_MST_FRM_ORA_SQLSERVER, Line 43
    The operation could not be performed because OLE DB provider "OraOLEDB.Oracle" for linked server "ORCL" was unable to begin a distributed transaction.
    BEGIN TRY
    -- MIGRATION OF PR_COMPANY_MH START
    BEGIN TRANSACTION T1
    PRINT 'mILAN NNNNNNNNN 11'
    INSERT INTO PROD.PR_COMPANY_MH
    SELECT * FROM OPENQUERY(ORCL, 'SELECT * FROM PR_COMPANY_MH WHERE SQL_FLG = ''N'' ')
    PRINT 'mILAN NNNNNNNNN 12'
    UPDATE OPENQUERY(ORCL, 'SELECT SQL_FLG FROM PR_COMPANY_MH WHERE SQL_FLG = ''N''')
    SET SQL_FLG = 'Y'
    --EXECUTE ('UPDATE PROD.PR_COMPANY_MH SET SQL_FLG = ''Y'' ') AT [ORCL]
    PRINT 'mILAN NNNNNNNNN 13'
    COMMIT TRANSACTION T1
    -- MIGRATION OF PR_COMPANY_MH END
    END TRY
    BEGIN CATCH
    PRINT 'mILAN NNNNNNNNN 14'
    ROLLBACK TRANSACTION T1
    PRINT 'mILAN NNNNNNNNN 15'
    SELECT
    @ErrorNumber = ERROR_NUMBER(),
    @ErrorSeverity = ERROR_SEVERITY(),
    @ErrorState = ERROR_STATE(),
    @ErrorLine = ERROR_LINE(),
    @ErrorProcedure = ISNULL(ERROR_PROCEDURE(), '-');
    PRINT 'mILAN NNNNNNNNN 16'
    SELECT @ErrorMessage = ERROR_MESSAGE();
    RAISERROR (@ErrorMessage, @ErrorSeverity, @ErrorState, @ErrorNumber, @ErrorProcedure)
    PRINT 'mILAN NNNNNNNNN 17'
    END CATCH
    this perticular part is raising that error, and i had tried every configuartion on my local machine related to MS DTC.
    When i remove my transaction code, its work just fine no exception raise, but when i use then i.e. BEGIN TRAN, COMMITE TRAN, AND ROLLBACK TRAN. its giving me error, other wise its fine.
    Please Help or disscus or suggest why my transaction base code is not woking????
    thanks in advance.
    Regards,
    Milan

    Sorry again, I am new on any kind of forum, so i am learning now, following is the error massage generated by SQL Server. and its not
    an architecture problem, i had just included my complete architecture to be more informative while asking for the solution or suggestion. My real problem is T-SQL, i think and its related to Distributed queries raise in SQL Server in Oracle Link Server.
    OLE DB provider "OraOLEDB.Oracle"
    for linked server "ORCL" returned message "New transaction cannot enlist in the specified transaction coordinator. ".
    Msg 50000, Level 16, State 2, Procedure PROC_MIGRATE_MST_FRM_ORA_SQLSERVER,
    Line 43
    The operation could not be performed because OLE
    DB provider "OraOLEDB.Oracle" for linked server "ORCL" was unable to begin a distributed transaction.

  • Maybe you are looking for

    • How do you choose bands when using the Dual n band routers?

      It say to use the 2.4 for surfing and the 5 for streaming video.how do you choose?

    • How do I get Shuffle to work on my iPod Touch?

      Sometimes Shuffle works for my music and other times it keeps repeating the same song.  I have tried hitting "Shuffle," tried resetting the iPod.  Nothing seems to help!  It usually happens after an update to the operating system.

    • New Button : Custom Action

      Hi Experts,     i have a VC application which display Sales Order Information based on the Customer, Material & Sales Organization. There are two buttons submit & reset everything works fine. Now i wish to add new button validate with custom event li

    • USB Port Limitations???

      Here's the deal. I have 1 20" aluminum iMac and 3 homebrew Windows PCs. The PCs are connected to an Iogear KVM-DVI powered switch to share Kbd, Mouse, and usb devices. On the iMac I had an Epson printer, a Canon scanner and Dymo Labelmaker connected

    • More than 2.5 million requests

      Is it possible that I can call Search API more than 2.5 million times in a month? How can I calculate the cost in that case? I could see the price for only fewer than 2.5 million requests in the table below. (datamarket.azure.com/dataset/bing/search)