-- get the file name local filename local filepath repeat cprintf(cli.lightgreen,"\nPlease enter the name of the file you wish to strip the Y axis from\n") printf(" File name > ") filename = io.stdin:read() if not string.find(filename,"%.xml$") then filename = filename..".xml" end filepath = getExecutionPath().."/"..filename if fileExists(filepath) then break else cprintf(cli.yellow,"\nFile not found: "..filepath.."\n") yrest(2000) end until false -- open the file local file, err = io.open(filepath, "r") if not file then error(err,0) end -- capture file in a string local sContents = file:read("*a") file:close() -- strip 'y's sContents = string.gsub(sContents," y=\"%d*\"","") -- write new file local newpath = string.match(filepath,"(.*)%.xml").."_noy.xml" file, err = io.open(newpath,"w") if not file then error(err,0) end file:write(sContents); file:close()