Question : Replace New Page Character in multiple text files - want something I can schedule

I have multiple text files created from a main frame that will format for an Access 2000 import during off hours. I am able to schedule formatting the files in Monarch and running imports into Access. The only problem is that the files, which are actually reports, from the main frame have page characters. This causes the headers in Monarch to fail as the characters are deleted along with the first one or two letters to the right of the characters. If I can remove the characters before formatting in Monarch, the problem is solved. I have tested this using find and replace in Notepad, but is not a global solution to the 100s of files I need to import. OS is XP.

Answer : Replace New Page Character in multiple text files - want something I can schedule

This bat file seems to work...

I'm using the SED from the CygWin package, but it's likely any version will work (there are some differences between various versions).
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
::@echo off
 
:: process each txt file in SourcePath directory
:: via SED to remove formfeed character writing
:: updated file to TargetPath directory.
::
:: NOTE:  Bypasses any files which already exist
::        in TargetPath
 
setlocal
 
set SourcePath=dir1
set TargetPath=dir2
 
for /f "tokens=* delims=" %%V in ('dir /a-d /b %SourcePath%\*.txt') do (
   if not exist %TargetPath%\%%V (
      sed "s/\x0C//g"  <%SourcePath%\%%V >%TargetPath%\%%V
   )
)
Open in New Window Select All
Random Solutions  
 
programming4us programming4us