home *** CD-ROM | disk | FTP | other *** search
- Path: news.ifm.liu.se!marcus
- From: marcus@lysator.liu.se (Marcus Comstedt)
- Newsgroups: comp.sys.amiga.programmer,comp.sys.amiga.applications,comp.unix.amiga
- Subject: Re: NEED HELP: Unix sh-script
- Date: 21 Mar 1996 15:34:43 GMT
- Message-ID: <4irsuj$bjb@newsy.ifm.liu.se>
- References: <4iph7u$cct@toad.stack.urc.tue.nl>
- NNTP-Posting-Host: tindra.lysator.liu.se
- Mime-Version: 1.0
- Content-Type: text/plain; charset=iso-8859-1
- Content-Transfer-Encoding: 8bit
- X-Newsreader: NN version 6.5.0 #24 (NOV)
-
- eka@stack.urc.tue.nl (Eka Durmin) writes:
-
- >Hello,
-
- >I want to make a script which can be executed on an Unix.
- >I have the same script (it does the same) for the Amiga shell-script:
- > step1:
- > what: search a keyword in a textfile
- > output: the line(s) (not the line numbers) containing this keyword
- > Amiga: grep
- > Unix: grep
- > step2:
- > what: get the #th line of a textfile (= output of step1)
- > output: the line
- > Amiga: Lines
- > Unix: ???
-
- sed -n "#p"
- (insert line number where # is)
-
- > step3:
- > what: get the #th word of a line
- > output: the word
- > Amiga: GetWord
- > Unix: ???
-
- awk '{print $#}'
- (insert word number where # is)
-
- Actually you can do both step 2 and 3 at the same time using:
-
- awk '{if(NR==#1)print$#2}'
- (insert line number where #1 is, and work number where #2 is.)
-
- / Marcus
- --
- --------------------------------------------------------------------------
- Marcus Comstedt Lysator Academic Computer Society
- marcus@lysator.liu.se Linko"ping University, Sweden //
- ----------------------------------------------------------------------\X/-
-