omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Newbie seeks help with a simple workflow

    Editorial
    3
    7
    2876
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Togow
      Togow last edited by

      I have lots of text like that below. The first line at the top of the paragraphs contain a percentage and a colon (eg 16.7%:). Below it appears at the left side of the text (I don't know why it does this) but it is in fact at the top of each paragraph. So assume the [figure %:] is at the top of the text.

      I want a workflow that removes it (the percentage and colon). See example below.

      Text before workflow processing

      16.7%:
      This view is no longer tenable against the background of the increased awareness of investors of the implications of bid situations

      96.7%:
      This Rule shall not apply in a case

      Text after workflow processing

      This view is no longer tenable against the background of the increased awareness of investors of the implications of bid situations

      This Rule shall not apply in a case

      1 Reply Last reply Reply Quote 0
      • ccc
        ccc last edited by

        In Pythonista, you can express the solution as:

        with open('the_text.txt') as in_file:
            for line in in_file:
                print(line.partition('%: ')[2] or line)
        

        Hopefully that will help you to create an Editorial workflow.

        1 Reply Last reply Reply Quote 0
        • Togow
          Togow last edited by

          Dear CCC
          Thank you for this. I really have no clue about how to implement your solution. I was hoping for a workflow kindly to be created for me which I could then install. Is this possible?

          1 Reply Last reply Reply Quote 0
          • ccc
            ccc last edited by

            Try http://www.editorial-workflows.com/workflow/5804196926324736/PaaF2slTo0U

            This my very first Editorial workflow ever but it is simple enough that it seems to work.

            Put your text in a local file called in_file.txt, run the workflow, and the results will be stored in a local file called out_file.txt.

            1 Reply Last reply Reply Quote 0
            • ccc
              ccc last edited by

              I updated the workflow to work on the current text document instead of separate in_file.txt and out_file.txt files.

              1 Reply Last reply Reply Quote 0
              • TutorialDoctor
                TutorialDoctor last edited by

                I believe a simple find and replace using regular expressions will work. Simple workflow. I will put it together to see if it is what you want.

                http://www.editorial-workflows.com/workflow/6696332232228864/GysCUfRsoBg

                It world on the currently loaded file.

                1 Reply Last reply Reply Quote 0
                • Togow
                  Togow last edited by

                  Thank you to CCC and Tutorial Doctor for their solutions which each worked perfectly. I am really grateful.

                  Tunde

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Powered by NodeBB Forums | Contributors