[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to read stdin as well as files?
From: |
Andrew J. Schorr |
Subject: |
Re: How to read stdin as well as files? |
Date: |
Fri, 28 Feb 2020 12:45:47 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, Feb 28, 2020 at 11:21:27AM -0600, Peng Yu wrote:
> The following example shows that when files are specified, stdin will
> not be read.
>
> What is the best way to first read stdin then read the files (knowing
> where the data is from)? Thanks.
>
> $ seq 3 | awk -e '{ print FILENAME, $0 }' <(printf '%s\n' {a..c})
> <(printf '%s\n' {A..B})
> /dev/fd/63 a
> /dev/fd/63 b
> /dev/fd/63 c
> /dev/fd/62 A
> /dev/fd/62 B
bash-4.2$ seq 3 | awk -e '{ print FILENAME, $0 }' /dev/stdin <(printf '%s\n'
{a..c})
/dev/stdin 1
/dev/stdin 2
/dev/stdin 3
/dev/fd/63 a
/dev/fd/63 b
/dev/fd/63 c
Regards,
Andy