home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / msdos / programm / 11577 < prev    next >
Encoding:
Internet Message Format  |  1992-12-22  |  3.0 KB

  1. Path: sparky!uunet!usc!chaph.usc.edu!aludra.usc.edu!not-for-mail
  2. From: aliu@aludra.usc.edu (Alex Liu)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Re: Normal MSDOS multitasking!
  5. Date: 22 Dec 1992 10:13:10 -0800
  6. Organization: None to Speak of
  7. Lines: 47
  8. Message-ID: <1h7lrmINNpde@aludra.usc.edu>
  9. References: <1ghb1vINNccb@ub.d.umn.edu> <9212142475@fcshome.UUCP> <dmurdoch.363.724430472@mast.queensu.ca> <1992Dec15.202449.28162@rd.hydro.on.ca> <dmurdoch.365.724454682@mast.queensu.ca> <1992Dec22.003509.8929@rd.hydro.on.ca>
  10. NNTP-Posting-Host: aludra.usc.edu
  11.  
  12. Hi,
  13.   I think what some people are missing is what is the idea of pipes.
  14. Under Unix, the concept of Pipes comes from the idea of linking small
  15. prewritten utilities to get something done as opposed to writing a
  16. entirely new application.
  17.  
  18. For example, let say, I want to display all the files in a UNIX directory
  19. that were created on a certain date, I also want to only display the filenames
  20. and in reverse sort order in columns.  One way to do it under Unix is:
  21.  
  22. ls -l | grep 'Aug 12 1990' | cut -c65- | sort -r | pr -t -4
  23.  
  24. (This is an example. May not work exactly right, but it will with some tweaking
  25. depending on the version of Unix you are using)
  26.  
  27. Now, doing something like that, as cryptic and complicated that it might look
  28. to the uninitated, it is MUCH MUCH better than writing a "ls" (or DIR) program
  29. that will do EVERYTHING under the sun.
  30.  
  31. You will be asking by now, what does this have to do with MS-DOS pipes?
  32. Well, this is just to illustrate a point.  A previous poster was arguing that
  33. doing:
  34.     zcat file.tar.Z | tar tvf - | grep foo
  35. is bad design, because you shouldn't have to do a compress just to find a file.
  36. But the point is that when they designed zcat/compress and tar, it was to 
  37. be modular.  compress is a generic file compressor, that you could use with
  38. any utility.  The fact that you have pipes allows you to use compress
  39. without having to write your own LZW compression routines.
  40.     unzip -v file.zip foo*.*
  41. Doing that, for you is fine, but it is not necessarily better.  It is just
  42. a different way to do things.  One could argue for example, that unzip is
  43. a more complicated program than any of the unix equivalents, and at the
  44. same token not as flexible.  For example, the 3 previous commands, you
  45. can also grep for files of certain size, certain date, etc.  By adding
  46. an extra command you could also sort them in reverse order or by size,
  47. etc.  If unzip was to accomplish all that flexibility, that would make
  48. the program much bigger.  If later, someone invents a new algorighm to
  49. make 1000:1 compression, you could still use tar, just replace zcat with
  50. your new compression program, but you will have to modify unzip (or wait
  51. until PKWare makes a new version).
  52.  
  53.  
  54. -- 
  55. _____________________________________________________________________________
  56. Alejandro Liu           |EMail: aliu@usc.edu |All mispellings are intentional
  57. 1551A Ridgecrest Apt A  |Voice: 213-264-9400 |Anything mentioned here is not
  58. Monterrey Park, CA91754 |                    |necessarily true.
  59.