Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-winken!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.wizards Subject: Re: Problem with shell script Message-ID: <2444@solo3.cs.vu.nl> Date: 2 May 89 21:15:02 GMT References: <1327@laura.UUCP> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 37 bause@exunido.uucp (Falko Bause) writes: \while ($e) \set f = "`tail -$e words | head -1`" \echo $f \awk '/"""`$f`"""/ {print (int('$1'/48)), "", "" }' skriptyyz #?? not correct \ # page length is exactly 48 \@ e = $e - 1 \end 1) For EVERY line you start up 2 programs, to skip the preceding lines! :-( Solution: use the BOURNE shell for scripts; see Kenneth Almquist's article. 2) If you're using csh's `@' feature, why not do it all the way? @ e-- 3) Can you say `indentation'? 4) What in G*d's name are you trying to do inside awk's first argument?! Trying if inserting some more quotes will help you out? Backquotes are used for COMMAND SUBSTITUTION; is $f a command? (That's rhetorical.) What you probably intended: awk /"$f"/'{print int($1/48), "", ""}' skriptyyz ^^^^^^ Why? Some remarks: - if you surround $f by double quotes, the SHELL won't evaluate its contents, but don't forget AWK knows some meta-characters too! What about a line solely consisting of `*'? The problem is awk expecting a regular expression, while you probably want a LITERAL match. I haven't got a solution at hand for this one. - The $1 is an AWK variable; the shell won't mess with it, since it's inside single quotes. -- "If it isn't aesthetically pleasing, |Maarten Litmaath @ VU Amsterdam: it's probably wrong." (jim@bilpin) |maart@cs.vu.nl, mcvax!botter!maart