我想下面的文本文件解析爲PowerShell的對象:解析文本文件分成多個PowerShell的對象
OBJECT Table 60000 My table 1
{
OBJECT-PROPERTIES
{
Date=09-09-16;
Time=11:27:31;
Modified=Yes;
Version List=;
}
}
OBJECT Page 60001 My Page
{
OBJECT-PROPERTIES
{
Date=09-09-16;
Time=11:28:18;
Modified=Yes;
Version List=;
}
}
的OBJECT-PROPERTIES
應該是PowerShell的對象的屬性。我還想將對象的文本包含在對象中。
我在說要做一些正則表達式,但我不知道如何將所有這些信息解析爲一個正則表達式。
我的對象遠遠長於2個對象,但僅僅是爲了示例,它只有2個對象。
預期輸出:
Object1:
Type: Table
Number: 60000
Name: "My table 1"
Date: "09-09-16"
Time: "11:28:18"
Modified: "Yes"
"Version List": ""
Object: "<All of the text in this object>"
Object2:
Type: Page
Number: 60001
Name: "My Page"
Date: "09-09-16"
Time: "11:28:18"
Modified: "Yes"
"Version List": ""
Object: "<All of the text in this object>"