[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Not so useless use of cat
From: |
Dennis Williamson |
Subject: |
Re: Not so useless use of cat |
Date: |
Tue, 16 Sep 2014 14:44:05 -0500 |
On Tue, Sep 16, 2014 at 2:03 AM, Ralf Goertz <address@hidden> wrote:
> Am Sat, 13 Sep 2014 12:53:48 -0600
> schrieb Bob Proulx <address@hidden>:
>
>
> > Dennis Williamson wrote:
> > > Bob Proulx wrote:
> > > > { for i in file[12] ; do cat "$i" ; done ;} > both
>
> > > There's no need for the curly braces and the last semicolon.
> >
> > Of course you are totally right. I was distracted by the subshell as
> > a concept. For re-stitching file with redirections a subshell isn't
> > needed and a list is convenient.
> >
> > > Note that the loop in this case can be replaced by
> > >
> > > cat file[12] > both
> > >
> > > I failed to spot that in my earlier reply.
> >
> > Me too. (But usually these are from more complex examples that can't
> > be simplified as much. It is just that all of the details aren't
> > shown.)
>
> Actually things are more complicated. I do need the /dev/stdout part. I
> obiously don't have the problem with `cat' but with some other program
> that doesn't write to stdout per se and expects a -o parameter for the
> output file. And this program just accepts one input file. I merely used
> the first `cat' in my example to make my point. So what I wanted was
>
> $ for i in file[12] ; do program -i "$i" -o /dev/stdout ; done > outfile
>
> which I assumed to be elegant and would do as I expected except it
> didn't and I really thought it could have been a bug. That's why I
> reported it here.
>
> Thanks for all replys,
>
> Ralf
>
>
>
Does your program support using a hyphen to represent stdout (some do)?
program -i "$i" -o -
--
Visit serverfault.com to get your system administration questions answered.
- Re: Not so useless use of cat, (continued)
- Message not available
- Re: Not so useless use of cat, Aharon Robbins, 2014/09/17
- Re: Not so useless use of cat, Andreas Schwab, 2014/09/17
- Re: Not so useless use of cat, Chet Ramey, 2014/09/17
- Message not available
- Re: Not so useless use of cat, Aharon Robbins, 2014/09/18
- Re: Not so useless use of cat, Chet Ramey, 2014/09/18
- Re: Not so useless use of cat, arnold, 2014/09/18
- Re: Not so useless use of cat, Greg Wooledge, 2014/09/18
- Re: Not so useless use of cat, Chet Ramey, 2014/09/18
- Re: Not so useless use of cat,
Dennis Williamson <=
- Message not available
- Re: Not so useless use of cat, Ralf Goertz, 2014/09/17
Re: Not so useless use of cat, Greg Wooledge, 2014/09/15