Question : how do I reorganise a text file in powershell ?

I have a TXT file repository (containing multiple text files)  and would like to 'grep' each file and do the following to each (but in one go) while retaining the file names. I'm sure there is a smarter way to do this... can you please help.
what id really like to do is "get-content *.txt |filter..." with the folloing filters:
can you help with coming up with a better way to do this?
Thanks
jason.


1.)remove expression  '------------':
cat 'C:\script\Arella\NewFile.txt' | foreach { $_ -replace '------------', ',' } |Set-Content C:\script\Arella\NewFile-Filter1.txt

2.) Remove Expression '<======================================>'
cat 'C:\script\Arella\NewFile-Filter1.txt' | foreach { $_ -replace '<======================================>', ',' } |Set-Content C:\script\Arella\NewFile-Filter2.txt

3.) Remove empty lines
gc 'C:\script\Arella\NewFile-Filter2.txt' |where {$_ -ne ""} |Set-Content C:\script\Arella\NewFile-Filter3.txt

4.) Selecting text that I know exists in each line I want and past it to a clean document -disregarding all the rest.
(type NewFile-Filter3.txt) -match "date"  | Out-File CleanFile.txt

Answer : how do I reorganise a text file in powershell ?

Or a bit "safe" solution:

filter cleantxt {
if($_.extension -eq ".txt"){
$content = $_ | Get-Content |
      Select-String -Pattern "date" |
      %{$_ -replace "------------",""} |
            %{$_ -replace "<======================================>",''}
Set-Content -Value $Content -Path $_.fullname
}
}
Random Solutions  
 
programming4us programming4us