X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 05D6A3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1681197323; bh=vqH9MsVk+GoBPuYciAXrPQCk0hfobgS5vR/TlMi64xQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=QzNAlhxN0xW4lOdFDU+tAWny9srHn4yNuYcPoo/2EHlXWPw9hNAAFW1kR5GlFBbFn H6HDW2NDBCgcoD7zA8TNA4kp2EFHSklJ4107ZrLtqz/32yq21Mm8awEEUy673eCwRo o4Gkz00ua4Wx7zGtgFIngzICoJfL+DTp27EocARw= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 404BB3858C3A MIME-Version: 1.0 Message-ID: To: "cygwincygwin.com" Subject: issue when piping from a windows program Date: Tue, 11 Apr 2023 09:15:03 +0200 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:d+U4p5xE/JpmzFzWia3OCM0aUML1/jE8VSAI99VWJd3HVOoIt4e7kc3Hbvr53hOV8gal/ IICLMRU7J0cEZ523b+a34rUZhp8WQBex6BdNhPllE0/opOcf92Il2dtvslvXpuTOpYH2rwADZvBC d2NKwdQ5+dUfNXZ1hWtRnIlpidj4nLxa/yxLuNNhJCAG2bpVD4aNlj3dUQjdUc62l80d9YAG44tq G4GonqaYBCCPYtf+Oj2xb5GHquzPJa63X32LQMYB8bYv8t7CNQ/sAoUVVZ/DFeOx9IMkYZhWorrm Sg= UI-OutboundReport: junk:10;M01:P0:DRsXoVVtVGA=;6T6hwZo3XHoNmLqlAjH41j9DAsF3e JN/8cIx4UEFRteneZtEK75BQB3NVOSx5ryw/SiLQZjQljpmcXO3/7vgpYpjxVYlZ28cwUMgb5 CKhA2XHpNJbcshXC8y/jzXZq77q6r/geBGrtpoeRWegBEa0DzUquW/C/GN1eZ3q+5D7nL+irv rkIt1Pxz74lWAM4q/lJj/exdEMsQ87HfbPWVwJipTvbzYXfgGKqZtyTjD1c++lauO/xRFx8xB b/6IaMq1yyMt4qZBNr6P/xsxwzLbHHgk2zAwL5fxm9AfCdKldqDlNzDpEX3iHMyhhSYbNQ2M8 vUdpVU1LxVrUipY2YdWybXVcSncXraicUupLUJMeGhRVyY6codZfem22vZ7nbkUYeMFPs3oup o9pa8TIxG5R0JetaCMvlVIKijkKrRdOzYxXfqbR8tLQ/nNhYVbykWpclm94b4q1Elq+5X6wXI i8q0QRcQ2p0UsOl/AiIjfnfky7RrrbUsXU9lkaNEFZlSLqmEHRnUMJb/Y1Ynj9Uw7WDcSL9xH AoOqKzd5QlsWXalcdi49XUMmvlXc+xPDsCwHnsJ7M/bTe1+5ZSVsJvbvvlsd1CTJd+4jRwibt LWwDzXEEv15iJYC/J5UhHEPAzzR2dvLzrQZ6KSAspjOQiKuGNhNrjpGEs6vjF/rQEm+0v0LK0 ArPhTZPwz8LtPMINFdahi+s9WhffqYMx4XBBK5i+Ukm5sgxyPRQUbf3/0nHZswLZNGKbUtr2C yEtx6zZYpIyfSwiNYYNLuAo+e5hu5KH1qz/EExczR8vb09ERwOFjkBa1PKDRjpIE+Wfgnsp8a iRbHusRwS98xZqDGZGFcjp2PDiqZE/TeyOgY0pkQvyTmf+njZnyUVsMsl2wSifxm X-Spam-Status: No, score=3.5 required=5.0 tests=BAYES_05, FREEMAIL_FROM, KAM_DMARC_STATUS, RCVD_IN_PSBL, RCVD_IN_SBL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: *** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Leonid Mironov via Cygwin Reply-To: Leonid Mironov Content-Type: text/plain; charset="utf-8" Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 33B7FlXf016771 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? Here are the hexdumps of 'wmic /NAMESPACE:\\\\root\\WMI PATH BatteryStatus get charging,voltage,remainingcapacity,chargerate>file' 00000000 ff fe 43 00 68 00 61 00 72 00 67 00 65 00 52 00 |..C.h.a.r.g.e.R.| 00000010 61 00 74 00 65 00 20 00 20 00 43 00 68 00 61 00 |a.t.e. . .C.h.a.| 00000020 72 00 67 00 69 00 6e 00 67 00 20 00 20 00 52 00 |r.g.i.n.g. . .R.| 00000030 65 00 6d 00 61 00 69 00 6e 00 69 00 6e 00 67 00 |e.m.a.i.n.i.n.g.| 00000040 43 00 61 00 70 00 61 00 63 00 69 00 74 00 79 00 |C.a.p.a.c.i.t.y.| 00000050 20 00 20 00 56 00 6f 00 6c 00 74 00 61 00 67 00 | . .V.o.l.t.a.g.| 00000060 65 00 20 00 20 00 0d 00 0a 00 30 00 20 00 20 00 |e. . .....0. . .| 00000070 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 | . . . . . . . .| 00000080 20 00 46 00 41 00 4c 00 53 00 45 00 20 00 20 00 | .F.A.L.S.E. . .| 00000090 20 00 20 00 20 00 33 00 37 00 37 00 33 00 34 00 | . . .3.7.7.3.4.| 000000a0 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 | . . . . . . . .| 000000b0 20 00 20 00 20 00 20 00 20 00 20 00 31 00 32 00 | . . . . . .1.2.| 000000c0 37 00 34 00 30 00 20 00 20 00 20 00 20 00 0d 00 |7.4.0. . . . ...| 000000d0 0a 00 |..| 000000d2 of wimic>file followed by dos2unix