title: SQLite replace every specified subpath with a new path
body: <p>Here is original output from track_locations table in sqlite3:</p>
  <h2>Table track_locations</h2>
  <p><em>attribute location</em>
  <em>'/Users/marcosvelazquez/Documents/Music/loops/Manuel Tur - 123 BPM.mp3'</em></p>
  <p><em>attribute directory</em>
  <em>'/Users/marcosvelazquez/Documents/Music/loops'*</em></p>
  <p><strong>I want a query that changes the</strong></p>
  <p><em>'/Users/marcosvelazquez/Documents'</em></p>
  <p><strong>path to</strong></p>
  <p><em>'/home/marc/Music'</em></p>
  <p><strong>So my new output would be:</strong></p>
  <h2>Table track_locations</h2>
  <p><em>attribute location</em>
  <em>'/home/marc/Music/Music/loops/Manuel Tur - 123 BPM.mp3'</em></p>
  <p><em>attribute directory</em>
  <em>'/home/marc/Music/Music/loops'*</em></p>
  <pre><code>import sqlite3
  
  con = sqlite3.connect('mixxxdb.sqlite')cur = con.cursor()
  
  for row in cur.execute('''SELECT location, directory FROM track_locations'''):
      rowTuple = row
      newLocation = ''
      newDir = ''
      newTuple = ()
  
      # Modifies the path for both location and directory
      newLocation = rowTuple[0]
      newLocation = newLocation.split('/Users/marcosvelazquez/Documents') 
      newLocation = '/home/marc/Music' + newLocation[1]
      print(newLocation)
  
      newDir = rowTuple[1]
      newDir = newDir.split('/Users/marcosvelazquez/Documents')
      newDir = '/home/marc/Music' + newDir[1]
      print(newDir)
  
      cur.execute('''UPDATE track_locations SET location = newLocation''')
      cur.execute('''UPDATE track_locations SET directory = newDir''')
  </code></pre>
  <p>Did a couple searches but did not find the answer. So then I tried with sqlite. Here is the query I have:</p>
  <pre><code>UPDATE track_locationsSET location = '/home/marc/Music' | ltrim(location,'/Users/marcosvelazquez/Documents')
  
  WHERE location IS NOT NULL;
  </code></pre>
  <p>This unfortunetly did not work either.</p>
  <p>Help would be greatly appreciated. Thanks!</p>