I have a Powershell script that reads the full content of an external data file. The file contains one line of header fields and the second line contains the associated data to those fields. My question is- how would I extract one of the fields in that file, in this case the "PO Number" field, and assign it to a variable in powershell? Below is the example of the file content and the command in Powershell to read the file.
HT|Dealer ID|Comment|Contact Name|Salesman|Dealer|Company name|Name|Home|Office|Cellular|Ship to|Address|Address|Address|File Name|PO Number|Catalog Name|Wall Door Style|Drawer Front|Drawer Pull|Door Pull|Price Level|
HI||1152678|||||, ||||||,|,|C:\Users\Documents\ Files\Breeze.kit|HJO PO|MC17R1|RAL.MP.S - Ralston Maple Square|No Option|||Ralston Maple
Initial Read Command:
$content = [IO.File]::ReadAllText($directorypath + "\Sample File.txt")