Skip to content

Instantly share code, notes, and snippets.

@Yardanico
Last active October 12, 2017 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yardanico/fbb8ab4e6b0a504f7a2ae879afbda05e to your computer and use it in GitHub Desktop.
Save Yardanico/fbb8ab4e6b0a504f7a2ae879afbda05e to your computer and use it in GitHub Desktop.
import tables, strscans
proc readData(path: string): Table[string, string] =
result = initTable[string, string]()
for line in path.lines:
var ip, guid: string
var extra: string
if scanf(line, "$+ [$+] ($+)", extra, ip, guid):
echo "User action: ", ip, " ", guid
result[ip] = guid
elif scanf(line, "$+ [$+] $+ GUID $+ ", extra, ip, extra, guid):
echo "Admin auth: ", ip, " ", guid
result[ip] = guid
echo readData("tata.txt")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment