jerschmidt14
2009-05-27 12:58:01 UTC
Hello,
I have text files approx 16-20mb in size. They are flat files with
approx 18-20 thousand records each. Every night I have to search them for
invalid ascii characters, and replace them with spaces. Call it a filter if
you will. What I wrote was
(gc filein.txt) -replace "^[\u0020-\u007F]"," " | sc fileout.txt
Although this seems to do the job, it runs VERY SLOW!
I have tried adjust the -read by adding
(gc filein.txt -read 5000 -replace "^[\u0020-\u007F]"," " | sc fileout.txt
This runs much faster. However, it then seems to miss the line endings.
Thanks in advance,
Jeremy
I have text files approx 16-20mb in size. They are flat files with
approx 18-20 thousand records each. Every night I have to search them for
invalid ascii characters, and replace them with spaces. Call it a filter if
you will. What I wrote was
(gc filein.txt) -replace "^[\u0020-\u007F]"," " | sc fileout.txt
Although this seems to do the job, it runs VERY SLOW!
I have tried adjust the -read by adding
(gc filein.txt -read 5000 -replace "^[\u0020-\u007F]"," " | sc fileout.txt
This runs much faster. However, it then seems to miss the line endings.
Thanks in advance,
Jeremy