| 
     
      
      
      From: Keith M. <kei...@us...> - 2010-04-01 20:36:06
      
     
   | 
On Wednesday 31 March 2010 23:22:41 Charles Wilson wrote: > On 3/31/2010 5:19 PM, Keith Marshall wrote: > > There is one tool, which is guaranteed to be both ubiquitous and > > consistently portable, for converting between MS-Windows CRLF > > and Unix LF line endings -- the venerable `awk'; this is > > precisely what the `d2u' and 'u2d' filters in recent MSYS base > > use to achieve the conversion. > > Um, Keith -- stop saying that. > > The script-based filters are no longer provided in "recent" MSYS. > AFAICT, they were removed in 1.0.12. Instead, the > cygutils-dos2unix-msys and cygutils-dos2unix-mingw32 packages > provide all of the desired functionality, in both msys-aware and > "normal" win32 modes. Even filtering. Sorry; perhaps I didn't fully appreciate the significance of... > Search your mail archives for an (offlist) message titled: > "lpr and cygutils" back in August, 2009. Also, see: > > http://article.gmane.org/gmane.comp.gnu.mingw.devel/3452 > Updated packages available (wave 6) > > > MSYS cygutils also provides implementations of dos2unix and > > unix2dos (u2d, d2u) that supplant the u2d and d2u shell scripts > > installed by msysCORE, as well as the dos2unix and unix2dos > > executables provided by mingw-utils-0.3. These new versions > > are, obviously, MSYS-dependent. I had thought that the basic scripts were to be supplanted only for those users who CHOSE to install the cygutils add-on package, and that those users who didn't adopt this choice would still have the capability to filter MS-DOS style line endings using the scripts. Personally, I can't see what benefit might accrue from the extra bloat of a (somewhat non-portable) .exe, when a ubiquitous filter program achieves the desired effect, in a more universally portable manner; the effect of dos2unix is as simple[1] as: $ awk '{sub("\r$",""); print}' dosfile > unixfile (or the completely equivalent): $ awk '{sub("\r$",""); printf "%s\n", $0}' dosfile > unixfile while unix2dos yields the equivalent of: $ awk '{sub("\r$",""); printf "%s\r\n", $0}' unixfile > dosfile and IMO, the not-so-standardised options provided by dos2unix and unix2dos, (in the absence of standardisation), are little more than window dressing. [1] Of course, this simple implementation depends on having an awk which doesn't have CRLF line endings mangled behind its back by the platform runtime library's I/O subsystem, (a typically Microsoft (mis)feature which, thankfully, MSYS' awk does not exhibit). -- Regards, Keith.  |