Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Find and Replace text then apply style

Return to Member Forum

  • Author
    Posts
    • #61578
      Cindy Kelley
      Participant

      I have 200 .txt (opened in Word) that have lines and lines of text starting with a descripter and a colon.

      I want to remove all text before and including the colon and space after the colon, then apply a style to “General”.
      Same thing on the next line, but with yet another style. and on and on and on. There are 45 instances I need to change otherwise I would just use Find and Replace.

      For example,

      Report Type: General
      Report Year: 2011
      Report Title: Scholarship Endowment
      Event Description: Now is the time for all good men to come to the aid of the country.

      I want to remove all text before and including the colon and space after the colon, then apply a style to “General”.
      Same thing on the next line, but with yet another style.

      Can this be done?

    • #61581

      Look in your Scripts panel, under Application. There you can find FindChangeByList, a handy script that reads its input fromman accompanying plain text file.

      As a footnote to the above script: you cannot remove text and apply a paragraph style at once. If there is no text in the “Change To” field but there is some formatting specified, ID just apllies the formatting — and, in general, that's a good thing too! But in your case, you have to use each find command twice.

      First, have it look for

      ^Report Type:

      (and add a space after that), and apply your Type style in the Change To field. Then repeat the same Find, but this time do not apply any formatting, so it will delete the text. Doing everything twice manually is a bore, but the FindChangeByList script won't mind.

    • #61595
      Anonymous
      Inactive

      Would this work?

      find:

      (Report Type: )(.+)

      replace:

      $2

      and apply paragraph style.

    • #61596

      Jesse, I think it would! But better put the ^ “Start of Paragraph” at the beginning, just to make sure it will only remove the right text.

      (Sure, there is little chance that particular text may occur inside a sentence, but better make it double-safe!)

    • #61603
      Cindy Kelley
      Participant

      Hi guys,

      I can figure out how to the FindChangeList.txt file to change text but not apply a paragraph style. :(

      I am stuck on your above note “apply your Type style in the Change To field.”

      I have tried every combination of change and/or apply I can think of.

      text {find what:”Report Title: “ } {change to: “”} {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false}

      thanks for any insite.

      I will keep trying…

Viewing 4 reply threads
  • You must be logged in to reply to this topic.
Forum Ads