123f24377SWarner Losh#!/bin/sh 223f24377SWarner Losh 323f24377SWarner Losholdawk=${oldawk-awk} 423f24377SWarner Loshawk=${awk-../a.out} 523f24377SWarner Losh 623f24377SWarner Loshecho compiling time.c 7*f32a6403SWarner Loshcc time.c -o time 823f24377SWarner Loshtime=./time 923f24377SWarner Losh 1023f24377SWarner Loshecho time command = $time 1123f24377SWarner Losh 1223f24377SWarner Losh#case `uname` in 1323f24377SWarner Losh#SunOS) 1423f24377SWarner Losh# time=/usr/bin/time ;; 1523f24377SWarner Losh#Linux) 1623f24377SWarner Losh# time=/usr/bin/time ;; 1723f24377SWarner Losh#*) 1823f24377SWarner Losh# time=time ;; 1923f24377SWarner Losh#esac 2023f24377SWarner Losh 2123f24377SWarner Loshecho oldawk = $oldawk, awk = $awk, time command = $time 2223f24377SWarner Losh 2323f24377SWarner Losh 2423f24377SWarner Losh# an arbitrary collection of input data 2523f24377SWarner Losh 2623f24377SWarner Loshcat td.1 td.1 >foo.td 2723f24377SWarner Loshsed 's/^........................//' td.1 >>foo.td 2823f24377SWarner Loshpr -m td.1 td.1 td.1 >>foo.td 2923f24377SWarner Loshpr -2 td.1 >>foo.td 3023f24377SWarner Loshcat bib >>foo.td 3123f24377SWarner Loshwc foo.td 3223f24377SWarner Losh 3323f24377SWarner Loshtd=foo.td 3423f24377SWarner Losh>footot 3523f24377SWarner Losh 3623f24377SWarner Loshfor i in $* 3723f24377SWarner Loshdo 3823f24377SWarner Losh echo $i "($oldawk vs $awk)": 3923f24377SWarner Losh # ind <$i 4023f24377SWarner Losh $time $oldawk -f $i $td >foo2 2>foo2t 4123f24377SWarner Losh cat foo2t 4223f24377SWarner Losh $time $awk -f $i $td >foo1 2>foo1t 4323f24377SWarner Losh cat foo1t 4423f24377SWarner Losh cmp foo1 foo2 4523f24377SWarner Losh echo $i: >>footot 4623f24377SWarner Losh cat foo1t foo2t >>footot 4723f24377SWarner Loshdone 4823f24377SWarner Losh 4923f24377SWarner Loshctimes footot 50