MLUG: RE: [MLUG] prepending a file
RE: [MLUG] prepending a file
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Yes, cat would work if all you wanted was two files.  However, if you
use the parens, you can do lots of nifty things, like capture the output
from multiple commands.

  ( cat header.txt ; \
    echo "here's a list of files in /tmp..." ; \
    find /tmp -type f -print ; \
    cat footer.txt ) > out

You can do the same with stderr and stdin using the proper redirects.
This is all handy dandy to know when you're stuck on a system witn no
Perl installed and you can't remember that crazy awk syntax.  This also
has the benefit of being a "one-liner;" I manage, without fail, to
forget one of my ">>" when doing redirects to append to a file, so I
have to start running the single commands again from scratch.

     ryan woodsmall
        EMAIL:PROTECTED


> -----Original Message-----
> From: EMAIL:PROTECTED 
> [mailto:EMAIL:PROTECTED] On Behalf Of Mark Rages
> Sent: Wednesday, March 03, 2004 12:22 PM
> To: MLUG Members
> Subject: Re: [MLUG] prepending a file
> 
> On Wed, Mar 03, 2004 at 09:53:22AM -0600, Woodsmall, Ryan 
> (IATS) wrote:
> > Why are you all making this so hard?  This should work in 
> bash/sh and
> > csh/tcsh:
> > 
> >   ( cat tmp2 ; cat tmp1 ) > out && mv -f out tmp1
> 
> Hey, doesn't cat stand for 'concatenate'?
> 
> Try this:
> cat tmp2 tmp1 > out && mv -f out tmp1
> 
> Regards,
> Mark
> EMAIL:PROTECTED

_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members