I have a text file with this format.
Configuration
;
;   Authors: James
;   Created: 10/11/2018
;
;   Accepted
Name
    James
Class
    A2
Birthday
    1 September 1982
Family Member
    4
First Year Salary Number
    100 USD
Second Year Salary Number
    150 USD
Company Name
    Unlimited Company
Total Salary Number
    1300 USD
ExpectedSalaryNumber
    FY:350 USD
    SY:450 USD
    TS:2000 USD
I want to remove the whole content if the head contain of "Salary Number" and "SalaryNumber", also remove the title "Configuration.... " and output the file after remove it. My expectation output file is like this
Name
    James
Class
    A2
Birthday
    1 September 1982
Family Member
    4
Company Name
    Unlimited Company
I tried this, but it just output the content that I remove. Anyone can help me please. Thank you so much.
$name = $false 
& { 
  switch -regex -file .\Configuration.TXT {
    '^*Salary Number*, ^*SalaryNumber*' { $name = $true; continue }
    '^\s' { if ($name) { $_.Trim() }}
    '^\S' { if ($name) { return } }
  }
} | Remove-Item | Out-File .\Output.txt
Updated Format File
ExpectedSalaryNumber
        FY:350 USD
        (White Space)
        SY:450 USD
        (White Space)
        TS:2000 USD
 
    