home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!ferkel.ucsb.edu!piggy!chupchup
- From: chupchup@ferkel.ucsb.edu (Robert Earl)
- Subject: Re: Standard AND piped input
- Message-ID: <Nov.721323995@piggy>
- Organization: (EVIL!)
- References: <1992Nov9.042122.18966@cs.sandia.gov>
- Date: Mon, 9 Nov 1992 15:46:35 GMT
- Lines: 33
-
- jhgreen@cs.sandia.gov (Jethro H. Greene) writes:
-
- | Followup-To: jhgreen@c.sandia.gov
-
- This is a nasty followup header; "Followup-To" should either be a
- newsgroup name or the word "poster" for mail replies. My news
- software wanted to post this to a newsgroup called
- "jhgreen@c.sandia.gov"...
-
- | When one pipes to something, the the output of the first becomes the input
- | of the second. What would you do if you wanted the output of the first to
- | be only be the beginning of the input for the second.
-
- | $ ls | thing_that_I_am_looking_for > output_file
- | bob is my dog
- | ^D
- | $ cat output_file
- | file1
- | file2
- | bob is my dog
- | $
-
- Try this:
-
- $ (ls; cat) > output_file
-
- In other words, start a subshell that runs *both* "ls" and "cat", and
- redirect the whole shebang to "output_file".
-
- --
- robert earl |
- rearl@ucsd.edu | "I got a bottle of tequila, baby, who needs friends?"
- rearl@piggy.ucsb.edu | --Johnette Napolitano, Concrete Blonde
-