Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=4576207 By: jakfrost
Just wanted to add my experience with this character and a solution as to how I got around it. I've been bitten by this End of File 0x1A character problem with Sed when working on some scripts parsing WINS name registration records that seem to contain all kinds of garbage and illegal characters, such as a \r \f \t, and one record containing \x1A. Now the strange this is that on my Windows XP SP2 workstation where I write my scripts this problem doesn't appear and Sed runs through the entire input file ~105,000 records and outputs all the formated records, but when I remotely execute my script on a Windows 2003 Server SP0 Sed stops processing the input file right when it encounters the line with the End Of File 0x1A character at about ~69,000 records. I've tested this behavior by creating a small test file containing some text and the special 0x1A character and parsed only that small file and the behavior repeats the same. I'm using GnuWin32 Sed.exe 4.1.5 with LibIConv2.dll 1.9.2.1747 and LibIntl3.dll 0.14.4.1952 on both systems and these 3 files are copied to the remote server for execution. That -B for binary mode option is not available in version 4.1.5 of GnuWin32 Sed.exe but -T (textmode) so I am guessing that -B is now the standard for opening files and that is good. When checking the DLL dependencies MSVCRT.DLL comes up with a lot of references to the basic functions for opening and dealing with files. My guess is that this is the file that contains a bug in the SP0 on server that has been fixed in the SP2 on the XP workstation. Microsoft Windows 2003 Server SP0 - 7.0.3790.0 shp 327,168 03-25-2003 msvcrt.dll Microsoft Windows XP Professional SP2 - 7.0.2600.2180 shp 343,040 07-20-2006 msvcrt.dll Unfortunatelly, since that DLL is already loaded in memory since it is used by so many applications I cannot force Sed.exe to re-load it by placing it into the same folder as the executable. I basically resolved this problem by prefixing my Sed commands with doing a Tr.exe replacement for 0x1A (octal 032) before sending the file to Sed. type "file.txt" | tr.exe "\032" " " | sed.exe ... ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=74807 ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ GnuWin32-Users mailing list GnuWin32-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gnuwin32-users