![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Removing lines from a text file Hi all, I want to remove line from txt file, exectly like i write line with out-file how can i do so ? Thanks |
My System Specs![]() |
| | #2 (permalink) |
| | RE: Removing lines from a text file I think you will need to read the file into PowerShell and check line by line for the file you want to remove - the rest of the file can be written back to a file -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty Blog: http://richardsiddaway.spaces.live.com/ PowerShell User Group: http://www.get-psuguk.org.uk "Did" wrote: > Hi all, > I want to remove line from txt file, exectly like i write line with > out-file > how can i do so ? > > Thanks > > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Removing lines from a text file > Hi all, > I want to remove line from txt file, exectly like i write line with > out-file > how can i do so ? > > Thanks ie (remove the third line of u:\testfile.txt) : $f=${u:\testfile.txt} $f[2]=$null ${u:\testfile.txt}=$f Regards, -- Jean - JMST Belgium |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Removing lines from a text file "Did" <didi10000@walla.co.il> wrote in message news:1173872693.838623.24650@d57g2000hsg.googlegroups.com... > Hi all, > I want to remove line from txt file, exectly like i write line with > out-file > how can i do so ? If you want to remove lines matching some specific text (e.g. "bouh"), you can write this: (type myfile.txt) -notmatch "bouh" | out-file mycleanfile.txt "bouh" can be any regular expression so you really have great control over your filter here. Hope that helps, Jacques |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Using lines in a text file | PowerShell | |||
| Howto: Add lines of text from a specific point in a text file.. | VB Script | |||
| get the number of lines in a text file | PowerShell | |||
| Removing lines from a text file by matching against substrings | PowerShell | |||
| removing first three lines in a text file | PowerShell | |||