X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9DD473857714 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1681203765; bh=0hRK6PH1LDPoGNKc/Ju7YNUtts8g2ZnSXFqx+2QlFE8=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=WwxudS4jaXMi3O1DPBWZ2t5CQXTpcUd6oqUrPpPCvBdWTve+xXYxQ+Yn+2+iVd4tp ixxQIIaPsPMTo9xEABl3CfKZXMoiiR7AhHNDSUradbtcKnM5WNb9fWF4S/wA6qLWwd 382M8XwjuuopC7aT9u5UcqpVDOk6zTvF6Lk6GDEk= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CC422385800A X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681203726; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yf5YMCDkhHtJj07OkP3uYqzURpNQrQfD/A6WomIJvsQ=; b=TjAVUOdVDcdqU1n1G12nOEGahspSJuphvN11SyJL36/1TrVtdeMA8kBMYYAO5nqcxY zrffNCTAxA+IBzIdq15OfdcZozFjmZptdK1/Wb1b1sjTrI4iQRV3E0YcxBfJg0XojTwy r4LboLYqjwxaFa8ejekqxqcb0Ib/HKlx28aLTJfOvxObfRXnHcCRifh6RG7UnrXto7rb taZY2fBP702DI3/Z0vz8pHc19/OgJusHSfFDH/YWJGpztlJ0BjNdaPBUDQB+TGdw1qSI gVgtnYayER7udi+GBMhSloiP8U77iP4chlZNm6hy8++zI6r3q6aG6fTALwxSUQibnuPH DalA== X-Gm-Message-State: AAQBX9cAH6I0ZZpNtduRz3VFxMY7Cao+Yfnd2S57g19xQc5eEcUtciJG STXO2ME7RPJREjkKxZM/jEcsh1K0vWLNYA== X-Google-Smtp-Source: AKy350a/hdvrgq7HmMSim4BALs6ywFFgsrYXBf6L8JoAEhWPJ7f4IRKvl98pR5mfr7j1hj3/FIWOfQ== X-Received: by 2002:a5d:60c1:0:b0:2ce:adbf:cb14 with SMTP id x1-20020a5d60c1000000b002ceadbfcb14mr1322939wrt.28.1681203726401; Tue, 11 Apr 2023 02:02:06 -0700 (PDT) Message-ID: <93787f32-eb6d-92ea-e5bb-8018c35717cc@gmail.com> Date: Tue, 11 Apr 2023 11:02:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: issue when piping from a windows program Content-Language: it To: cygwin AT cygwin DOT com References: In-Reply-To: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 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: Marco Atzeri via Cygwin Reply-To: Marco Atzeri Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "Cygwin" On 11.04.2023 09:15, Leonid Mironov via Cygwin wrote: > 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' > use "iconv" to change the codification and than d2u for the line termination $ iconv -f UTF16 -t UTF8 file ChargeRate Charging RemainingCapacity Voltage 0 FALSE 0 0 $ iconv -f UTF16 -t UTF8 file |od -c 0000000 C h a r g e R a t e C h a r 0000020 g i n g R e m a i n i n g C 0000040 a p a c i t y V o l t a g e 0000060 \r \n 0 0000100 F A L S E 0 0000120 0 0000140 \r \n 0000150 $ iconv -f UTF16 -t UTF8 file |d2u | od -c 0000000 C h a r g e R a t e C h a r 0000020 g i n g R e m a i n i n g C 0000040 a p a c i t y V o l t a g e 0000060 \n 0 F 0000100 A L S E 0 0000120 0 0000140 \n 0000146 -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple