Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!lll-winken!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.questions Subject: Re^2: csh: still trying to read file Keywords: csh C shell read programming unix Message-ID: <2239@star.cs.vu.nl> Date: 3 Apr 89 04:25:40 GMT References: <2130@pikes.Colorado.EDU> <2156@cveg.uucp> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 27 jms@hcx.uucp (Michael Stanley) writes: \... Keep a variable which \is the number of the next line you plan to read. Each time you read \a line, you can add one to it. Now, knowing the line number, how do I \get that line from a file... Try this: \ set file_name = "TESTFILE" \ set line_no = "5" \ set line_buff = `sed -n "${line_no}p" $file_name` \ echo $line_buff So for every line you must skip n - 1 lines first! Furthermore: how are you going to distinguish eof from empty lines? \... \ setenv PATH "/bin:/usr/bin:/usr/local:~yourid/bin" By this scheme any subcommand that invokes execvp() one way or the other, will `fail': the environment variable is LITERALLY set to the above, that is, including the tilde, and the directory "~yourid" isn't the directory you intended to include (and it probably doesn't exist). Use `set path=(...)' or `setenv PATH ...$HOME/bin'. RTFM. Furthermore "~yourid/bin" ("~/bin", for insiders :-) should be the FIRST directory in your PATH. -- Modeless editors and strong typing: |Maarten Litmaath @ VU Amsterdam: both for people with weak memories. |maart@cs.vu.nl, mcvax!botter!maart