我有行字符串以下行(迭代線):如何根據行中的特定單詞對行字符串(迭代字符串)進行排序?
05-10-2016 15:22:20 %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up 05-10-2016 15:22:31 %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to down 05-10-2016 15:22:43 %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to down 05-10-2016 15:22:53 %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
我想根據接口名,時間戳行進行排序,這樣的結果應該是:
05-10-2016 15:22:20 %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up 05-10-2016 15:22:43 %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to down 05-10-2016 15:22:31 %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to down 05-10-2016 15:22:53 %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
有人可以幫助我使用PowerShell完成此任務嗎?
注意:接口名稱可能與上面提到的不同。
哪條命令是你用來獲得這個輸出? –
這是一個測試日誌文件,它使用get-content PS命令讀取。 – Sami