1
我需要在openssl的index.txt文件中查找特定記錄,然後根據時間戳對它們進行排序,以便最新的記錄出現在頂部。我把文件讀入一個數組,數組是這樣的:(我甩表到一個日誌文件)如何根據時間戳對openssl的index.txt進行排序
database= {}
database[1] = "R 140318001552Z 130318002148Z 7D unknown /[email protected]/[email protected]"
database[2] = "V 140318001809Z 7E unknown /[email protected]/[email protected]"
database[3] = "V 140318002157Z 7F unknown /[email protected]/[email protected]"
這個我想能夠通過第二到這個數組排序列,這是時間戳。我需要將最新的記錄先排序。 我如何在lua中編寫此代碼?
謝謝。
你介意擴展你的答案,包括代碼來做string.match你提到?我對盧阿很新。謝謝 – dot 2013-03-18 01:36:48
@dot'string.match'是一個標準的庫函數。只需在您的lua文件的開始處輸入「require」字符串「'」。參見[here](http://www.lua.org/manual/5.2/manual.html#pdf-string.match)的文檔和[here](http://www.lua.org/manual/5.2) /manual.html#6.4.1)瞭解模式的工作方式。 – 2013-03-18 08:30:55