September 30, 2004 --- Class 10 --- Graphing velocity ratio, Root Finding (continued) Activities: Graphing the velocity ratio as function of the height via shell script It is relatively easy to make a graph of the velocity ratio as a function of the initial height. We can use a foreach loop to set the initial height. Then, we need to manipulate the output of adapt_step to get the velocity ratio. This last step is done with an awk script. The awk file ~sg/vel_ratio.a contains two lines: /^V/{vel=-$4; rec=NR} NR==rec+1 && NR >1 { ratio =vel/$1; print ratio} Below is a shell script to run adapt_step and pipe the output through awk. If you run this at the screen, you will find all the prompts from adapt_step, which are written to the standard error, mixed up with the output from the awk script, which are written to the standard output. If you redirect the standard output to a file with the ">" symbol, only the output you want will wind up in the file. #!/bin/csh foreach height ( 20000 40000 60000 80000 100000 120000 140000 160000) echo -n $height " " adapt_step <