C-shell programming
peter da silva
peter at ficc.ferranti.com
Fri Aug 10 03:18:58 AEST 1990
(a) The Bourne shell is a *much* better programming tool. Why are you using
the C shell for scripts?
(b) The "join" command could be used to make a pipeline out of this.
#!/bin/sh
# If not already sorted:
for i in 1 2 3
do
sort -d NN.dat$i > NN.sort$i
done
join -j 1 -o 1.1 1.2 1.3 2.2 2.3 NN.sort1 NN.sort2 |
join -j 1 -o 1.1 1.2 1.3 1.4 1.5 2.2 2.3 - NN.sort3 |
awk '{print $1"/"$2"/"$3"/"$4"."$5"."$6" "$7}'
Appropriate use of /dev/fd could make it even neater, if you don't already
have sorted files.
--
Peter da Silva. `-_-'
+1 713 274 5180. 'U`
<peter at ficc.ferranti.com>
More information about the Comp.unix.questions
mailing list