How to delete first line of a file from powershell ise?

I have a file with the content of

09-JAN-2018
12-FEB-2018
13-MAR-2018

Could you help me on, How could I delete the first line of the file from PowerShell.

Thank you in advance

2 answers

  • answered 2018-07-12 06:28 Quiron

    This takes the data from file1.txt without the first line, then prints it into file2.txt

    Get-Content file1.txt | Select-Object -Skip 1 | Out-File file2.txt
    

    But it will be usefull to know if you are working with a .txt file, a .csv, .xml or other type of file.

  • answered 2018-07-12 07:43 Uni_x

    This should work:

    get-content $file |
        select -Skip 1 |
        set-content "$file-temp"
    move "$file-temp" $file -Force