Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!unido!laura!exunido!bause From: bause@exunido.uucp (Falko Bause) Newsgroups: comp.unix.wizards Subject: Problem with shell script Message-ID: <1327@laura.UUCP> Date: 28 Apr 89 12:15:52 GMT Sender: root@laura.UUCP Reply-To: bause@exunido.UUCP (Falko Bause) Organization: University of Dortmund, W-Germany Lines: 33 Trying to go deeper into UNIX, i've a problem with the substitution of variables. I've a file named skriptyyz with line numbers in the first collumn (produced by cat -n) and a file named words which contains the words for generating a register. The following shell script should generate this register: echo REGISTER echo " " rm -f skriptyyz cat -n $1 > skriptyyz # $1 == "text" set d = `wc -l words` set e = $d[1] 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 The problem is calling awk. awk shall use the pattern in the variable f. Unfortunately f can also contain patterns like "$ber", which should be interpreted as the string (!) "$ber" and not as the variable ber. What is the right syntax for calling awk and how is variable substitution performed? And is there an easier and faster way in generating a register? Thanks Falko