home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / ultrix / 5831 < prev    next >
Encoding:
Text File  |  1992-07-22  |  1.8 KB  |  53 lines

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