Guest User

Untitled

a guest
Feb 25th, 2021
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. from subprocess import run as proc_run, PIPE as proc_PIPE
  2. from os.path import splitext
  3.  
  4. grep_out = proc_run(['grep', '-rnw', '/var/www/standard_notes/standardnotes-extensions/', '-e', 'filesafe.standardnotes.org', '-o'], stdout=proc_PIPE)
  5. grep_out = grep_out.stdout.decode('utf-8')
  6.  
  7. instances = [x.split(':') for x in grep_out.split('\n') if x != '']
  8.  
  9. for instance in instances:
  10.     if splitext(instance[0])[1] != '.py':
  11.         print(instance)
  12.         input("Press Enter to continue...")
  13.  
  14.         with open(instance[0], 'r') as f:
  15.             text = f.read()
  16.  
  17.         text = text.replace('filesafe.standardnotes.org', '[your URL here]')
  18.  
  19.         with open(instance[0], 'w') as f:
  20.             f.write(text)
Advertisement
Add Comment
Please, Sign In to add comment