www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/10/11/10:13:19

Date: Thu, 11 Oct 2001 16:09:11 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: JT Williams <jeffw AT darwin DOT sfbr DOT org>
cc: djgpp AT delorie DOT com
Subject: Re: duplicating stdin in shell script
In-Reply-To: <20011011085728.A15517@kendall.sfbr.org>
Message-ID: <Pine.SUN.3.91.1011011160846.21594G-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, 11 Oct 2001, JT Williams wrote:

> Is it possible/practical to duplicate stdin (without using tmp files)
> so that it can be scanned twice in a shell script?  If so, could someone
> please show me a shell idiom to do this?
> 
> For example, suppose I want to scan a tab-delimited text file to determine
> the maximum width of each field, so I can then pass stdin to `expand'
> using appropriate options.

You could copy stdin to a temporary file, and then work on that.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019