I have a log file that gives me the following content every day:
Import1:
2019-09-09 19:05:07.568 INFO Stock Record Fetched: alsn_value: 63007409, mtrl: 1, sblc: 1, infc: 2, bacn_value: 9783492058575, locn: 1, chol: 64, shlf: Efm 3.4 SUCH, edatum: 2019-09-09
2019-09-09 19:05:20.570 INFO Stock Record Fetched: alsn_value: 63012211, mtrl: 1, sblc: 1, infc: 2, bacn_value: 9783125633254, locn: 1, chol: 64, shlf: Ock 2 LANG, edatum: 2019-09-09
Import 2:
2019-09-09 19:05:22.168 INFO Stock Record Fetched: alsn_value: 63012605, mtrl: 1, sblc: 1, infc: 2, bacn_value: 9783193133076, locn: 1, chol: 64, shlf: Odl 7 COLO A2, edatum: 2019-09-09
I don't need all the information. I just need:
alsn_value: XXXXXXXXXX,
bacn_value: XXXXXXX,
shlf XXXXX XXX XX ,
edatum: xxxx-xx-xx
I have selected it with the following command, but I do not get the right result:
$select = Select-String -Path "D:\error.log" -Pattern 'alsn_value:' | select line
$asd = $select.Line.Split(' ')[6,7,14,15]
Please suggest how to solve it nicely.