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.


    Python or workflow to batch run multiple regex substitutions on multiple files

    Editorial
    1
    1
    1567
    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.
    • robopu
      robopu last edited by

      the title says it all.

      i basically have a bunch of text files with a given extension in editorial (and or via dropbox). i would love to be able to batch process a bunch of these files by triggering a single workflow and or pythonista script. the subset of files could be

      1. all the files in a given folder,
      2. all the files in a given folder and any child folders
      3. a list of selected files

      but i'm not sure how to prompt to select files or folder(s) or specify some "current" folder in editorial workflow / triggered pythonista script.

      after i get the list, i'm not sure how to specify and then carry out 1 or more regex substitutions on each file in the list

      finally, i need to save changes to the original file and or a backup of it with some change in the filename.

      can anybody point me to a similar script or workflow that allows for specifying / selecting multiple file(s) / folder(s) and or applying multiple regexs to them? i'm having trouble finding something similar to the functionality for either of those tasks in either the forums or existing workflows. not asking people to do the work for me unless something is indeed already out there. i just need a pointer to something to get started as these seem like very common tasks related to working with batches of files. i can already do this using batch processing in vim but i want to find a way to do it within editorial.

      thanks in advance

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