Here are some methods:
#emulate get-content
$lines = @'
$M00000000,$F000000,$J08,$V1000,$f000000,$m0000000,$n0000000
$M00000000,$F000000,$J08,$V1000,$f000000,$m0000000,$n0000000
$M00000000,$F000000,$J08,$V1000,$f000000,$m0000000,$n0000000
$M00000000,$F000000,$J08,$V1000,$f000000,$m0001274,$n0001274
$Z,$I RW6 ,$N 1 ,$G201120,$H141340,$M00000000,$F000000,$X0000001240,$U0000
'@ -split [environment]::NewLine
$wo = ($lines[-1] | Select-String -Pattern '(?<=\$X).*?(?=,)').Matches.Value
#or
$wo = ($lines | Select-Object -Last 1 | Select-String -Pattern '(?<=\$X).*?(?=,)').Matches.Value
#Convert into PSObject
$restOfData = $lines | Select-Object -First ($lines.Count -1) | ConvertFrom-Csv -Header 'Hdr1','Hdr2','Hdr3','Hdr4','Hdr5','Hdr6','Hdr7'
OutPut:
PS C:\Users\rasim> $wo
0000001240
PS C:\Users\rasim> $restOfData | Format-Table -AutoSize
Hdr1 Hdr2 Hdr3 Hdr4 Hdr5 Hdr6 Hdr7
---- ---- ---- ---- ---- ---- ----
$M00000000 $F000000 $J08 $V1000 $f000000 $m0000000 $n0000000
$M00000000 $F000000 $J08 $V1000 $f000000 $m0000000 $n0000000
$M00000000 $F000000 $J08 $V1000 $f000000 $m0000000 $n0000000
$M00000000 $F000000 $J08 $V1000 $f000000 $m0001274 $n0001274