adding text after a line

This topic contains 1 reply, has 1 voice, and was last updated by  Tony Antony 3 weeks ago.

  • Author
    Posts
  • #83221

    Tony Antony
    Participant

    I'm trying to add the word "br" in a text file, but it's not adding.

    if ($employees.Title -eq "NULL") {
            (Get-Content $public_html_files\$txt_file_names) | Where-Object {$_ -notmatch "TITLE"}  | Set-Content $public_html_files\$txt_file_names -Force        
            $add_break = Get-Content $public_html_files\$txt_file_names
            $add_break[5] += "br"
    }
  • #83233

    Tony Antony
    Participant

    I figured it out, thank you

    if ($employees.Title -eq "NULL") {
            (Get-Content $public_html_files\$txt_file_names) | Where-Object {$_ -notmatch "TITLE"} | Set-Content $public_html_files\$txt_file_names -Force        
            $add_break = Get-Content $public_html_files\$txt_file_names
            $add_break[5] += ""
            $add_break | Set-Content $public_html_files\$txt_file_names -Force                
        }

You must be logged in to reply to this topic.