Another sed question.
Conor P. Cahill
cpcahil at virtech.uucp
Sun Dec 3 00:43:48 AEST 1989
In article <37091 at ames.arc.nasa.gov>, gahooten at 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 |
+-----------------------------------------------------------------------+
More information about the Comp.unix.questions
mailing list