-- TIME_STAMP 2013-06-06 13:14:02 ------------------------------------------------------------------------- --[[ Damit das Skript aus SciTE mit "F5" gestartet werden kann: • in SciTEUser.properties eintragen command.go.*.lua=dofile $(FilePath) ]] ------------------------------------------------------------------------- ------------------------------------------------------------------------- local Clock = function() local datetable = os.date("*t", os.time()) return string.format('%02d:%02d:%02d', datetable.hour, datetable.min, datetable.sec) end ------------------------------------------------------------------------- ------------------------------------------------------------------------- EditFile = function(_sFile, _sFileOut) print('--> ' .. Clock() .. ' Dateibearbeitung Start') _sFileOut = _sFileOut or _sFile -- wenn "_sFileOut" nicht übergeben, wird "_sFile" überschrieben local fh = io.open(_sFile) local s = fh:read('*a') fh:close() local p1, p2 = "(%-?%d+%.%d+)", "(%s%d%d%s%d%d%s%d%d)" local repl = function(_s) _s = _s*100 len = #tostring(_s) if _s < 0 then n = 11-len else n = 10-len end return tostring(_s)..('0'):rep(n) end local s1 = s:gsub(p1, repl):gsub(p2, "") fh = io.open(_sFileOut, "w+") fh:write(s1) fh:close() print('+-> ' .. Clock() .. ' Dateibearbeitung Ende') end ------------------------------------------------------------------------- local sFile = "C:\\Users\\BugFix\\Downloads\\test_focus.txt" -- Doppel-Backslash beachten! local sFileOut = "C:\\Users\\BugFix\\Downloads\\test_focus_out.txt" -- Doppel-Backslash beachten! EditFile(sFile, sFileOut)