使用 csplit 并使用 "incr|full|manual" 运算符,但我想知道哪一个在一行中匹配

using csplit and using "incr|full|manual" operator but i like to know which one was match in a line

我有台词

bpdppa301p.corpads.local 86929680 JC_UNIX_FS01_INCR JC_FS UNIX_FS01_INCR incr 02/24/2022 03/30/2022 03/30/2022  disk 1645678800 backup 84 MB /dbwsrp01/dbwsrp01           JCBDD1300P.corpads.local
bpdppa301p.corpads.local 82578060 MN_DB_ORA                manual 02/24/2022 04/21/2022 03/31/2022         disk 1645678854              80 MB RMAN:PFDPRE01_jf0mjj9l_1_1    MNBDD3302P.corpads.local
bpdppa301p.corpads.local 86929880 JC_UNIX_FS01_INCR JC_FS UNIX_FS01_INCR Notincr 02/24/2022 03/30/2022 03/30/2022  disk 1645678800 backup 84 MB /dbwsrp01/dbwsrp01           JCBDD1300P.corpads.local

我正在通过以下代码选择线路 $mn=$line -csplit "incr|full|manual" 但我还需要一种方法来捕获一行中哪一个匹配增量或完整或手动。有什么想法吗?

使用 () 捕获匹配的词,这将使 PowerShell 将其包含在拆分操作的输出中:

$mn = $line -csplit "(incr|full|manual)"
$mn[1] # this will now contain `incr`, `full` or `manual`