Path: utzoo!utgpu!watserv1!watmath!iuvax!mailrus!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.questions Subject: Re: Another sed question. Message-ID: <1989Dec2.134348.22524@virtech.uucp> Date: 2 Dec 89 13:43:48 GMT References: <37091@ames.arc.nasa.gov> Organization: Virtual Technologies Inc. Lines: 27 In article <37091@ames.arc.nasa.gov>, gahooten@orion.arc.nasa.gov (Gregory A. Hooten) writes: > #!/bin/sed d1 > What it did was to delete the line starting with the # sign and display all > of the text that was in the file. > My questions are, why do it this way instead of using echo? Because the programmer wanted to do it that way. Lots of echos would have been ugly, but a cat with here documents would have been just as clear and probably as efficient. > Why is the # line considered line 1, when it was used > to start the command in the first space, it seems to me that the line would > have already been sent to the terminal to start the sed, and so would not > be deleted? Because nothing in the file is "sent to the terminal". The kernel passes the entire file to said program. -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+