home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.ultrix
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!mips!decwrl!pa.dec.com!nntpd2.cxo.dec.com!nfinit.enet.dec.com!wombat
- From: wombat@nfinit.enet.dec.com (Christopher M. Conway)
- Subject: Re: How do you cat together files without getting subdirs?
- Message-ID: <1992Jul22.160350.25829@nntpd2.cxo.dec.com>
- Lines: 40
- Sender: wombat@outback (Christopher M. Conway)
- Reply-To: wombat@nfinit.enet.dec.com
- Organization: Prickly Wombat Enterprises
- References: <110593@muvms3.bitnet> <1992Jul22.010325.27235@decuac.dec.com>
- Date: Wed, 22 Jul 1992 16:03:50 GMT
-
-
- In article <1992Jul22.010325.27235@decuac.dec.com>, mjr@hussar.dco.dec.com (Marcus J. "will do TCP/IP for food" Ranum) writes:
- -
- - To get all files in a directory that are not subdirectories or devices:
- -
- - (for a in *; do
- - if [ -f "$a" ]; then
- - cat $a
- - fi
- - done) > /tmp/output
- -
- That's the Bourne Shell version. I'm not sure that you can do it directly
- on the command line in the C shell, but this as a script would work:
-
- #! /bin/csh
- foreach i (*)
- if ( -f $i ) then
- cat $i
- endif
- end
-
- just run this, sending stdout to a file.
-
- - There is probably some way to do this with a single grotty line of perl...
-
- Probably, and we'll see 10 different versions of it, each using one less
- character than the one preceeding it... B^{)>
-
- --
- Boycott Kodak
- --------------------------------------------------------------
- Christopher M. Conway | U*ix and C Guru
- wombat@nfinit.enet.dec.com | Legalize Freedom!
- wombat@juliet.ll.mit.edu | Marrou/Lord in '92!
- nfinit::wombat (DECnet internal)| (505)761-2413 DTN 552-2413
- --------------------------------------------------------------
- In no way should any statement, question, or other transferral
- of information in this post should be construed in any way
- as being an official communication of Digital Equipment
- Corporation.
-