Hello everyone,
I have script below which will delete a line that contains a certain string which works fine but it is extremely slow since file2 is big (over 50MB). To increase performance, how do I modify it to do:
- Delete only one line on first match (don't know if this will improve performance)
- file2 get's saved on every run which may cause performance issue?
Other ideas to improve performance will be greatly appreciated. Thank you.
foreach ($string in (Get-Content c:\strings.txt))
{
(Get-Content 'c:\file2.csv') -notmatch $string | Set-Content 'c:\file2.csv'
}