issue when piping from a windows program

Andrey Repin anrdaemon@yandex.ru
Tue Apr 11 14:43:22 GMT 2023


Greetings, Leonid Mironov!

> I am trying to feed the output of wmic.exe - a windows console program, to cygwin bash script.
> wmic.exe produces UTF16LE output with BOM and CR/LFs, so I am using dos2unix to convert it.
> The problem is that when I write wmic.exe output to a file and then use dos2unix to convert this file
> I get the expected result - ASCII file with LFs, I get the same result when I pipe this file to dos2unix,
> but when I pipe wmic.exe output directly to dos2unix I get ASCII file with CR/LFs and an extra empty line.
> Cygwin is up to date, windows 10. What gives?

You don't need d2u. Use `… | iconv -f UTF16LE | tr -d '\r'`
(Don't even need -t for iconv - it assumes current locale settings as
default source/destination encoding.)


-- 
With best regards,
Andrey Repin
Tuesday, April 11, 2023 17:41:32

Sorry for my terrible english...


More information about the Cygwin mailing list