import sys
import os

def parse_json():
	with open(sys.argv[1]) as f:
		for line in f:
			line = line.replace("\n","")
			fw = open(line+".txt", "w")
			with open(line) as fr:
				for line1 in fr:
					if "ultralisk.cs.washington.edu" in line1:
						fw.write(line1.replace("ultralisk.cs.washington.edu","130.245.144.36"))
					elif "/pages/" in line1:
						fw.write(line1.replace("/pages/","/server/pages/"))
					elif "/missing/" in line1:
						fw.write(line1.replace("/missing/","/server/missing/"))
					else:
						fw.write(line1)	
			os.rename(line+".txt",line)
parse_json()

