From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13283 invoked by alias); 20 Aug 2008 13:15:52 -0000 Received: (qmail 13235 invoked by uid 22791); 20 Aug 2008 13:15:50 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 20 Aug 2008 13:14:42 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KVnWJ-0004TK-1s for cygwin-talk@cygwin.com; Wed, 20 Aug 2008 13:14:39 +0000 Received: from 193.215.235.43 ([193.215.235.43]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Aug 2008 13:14:39 +0000 Received: from rschm by 193.215.235.43 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Aug 2008 13:14:39 +0000 To: cygwin-talk@cygwin.com From: Robert Schmidt Subject: Re: My pipe flushes late Date: Wed, 20 Aug 2008 13:15:00 -0000 Message-ID: References: <48AC108E.1D666660@dessent.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) In-Reply-To: <48AC108E.1D666660@dessent.net> X-IsSubscribed: yes Mailing-List: contact cygwin-talk-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-talk-owner@cygwin.com Reply-To: The Vulgar and Unprofessional Cygwin-Talk List X-SW-Source: 2008-q3/txt/msg00053.txt.bz2 Brian Dessent wrote: > Robert Schmidt wrote: > Oh, I missed that qualifier. So, what you really mean is that sed is a > total red herring as you aren't actually using sed but something else > entirely in the real application? Anyway, if you absolutely must have a > d2u that is line buffered instead of full buffered then you can use > > perl -pe 'BEGIN { $| = 1; } s,\r$,,;' | whatever_the_actual_thing_is Thanks! In the meantime, I've discovered that the reason for d2u (the read builtin freezing on single 0x0D characters) seems to be gone in cygwin, so I can simplify my script. For completeness, my real script is: #!/bin/bash # read stalls on 0x0d in input, d2u fixes that, but introduces buffering d2u | while true do read -r || exit echo `date +"%F %T"` "$REPLY" done ... where d2u can probably be removed now. It's used to timestamp output from various services, some of which output DOS line endings. E.g. my-service.sh | prefix-time.sh. If there was a way to execute a command (date, in my case) from within the sed replacement section, I'd be home free with a single sed process instead of a chunky bash process lurking about. Robert