On Thursday 21 November 2002 5:02 am, Allan Rae wrote:
> On Wed, 20 Nov 2002, Angus Leeming wrote:
> > I have been playing a little with the scripts we use to modify the code
> > output by fdesign. I have used "sort" to create a minimal list of the
> > functions called by the .C file:
> >
> > EXTERN_FUNCS=extern.tmp
> > sed -n 's/extern void \(.*\)/extern "C" void \1/p' ${HIN} >
> > ${EXTERN_FUNCS}
> >
> > if [ -s ${EXTERN_FUNCS} ]; then
> > sort -u ${EXTERN_FUNCS} > tmp
> > mv -f tmp ${EXTERN_FUNCS}
> > fi
> >
> > My question: is "sort -u" standard, or should I pipe the results of
> > "sort" to "uniq"?
>
> Every script I've seen pipes through uniq.
>
> BTW, why aren't you using sed to do the whole lot?
Well, when you come to read this...
I'm not using sed to do the whole lot, because parsing multiple lines to
output only one is not a thing that sed's good at.
Incidentally, when you do come to read this, dig out fdfixh.sed. it's evolved
from the 'black magic' that I had originally and that somehow worked. (I'm
talking about the struct manipulation stuff using the hold space, not about
the stuff that I inherited, of course. ;-). It's now an extremely clean and
comprehensible sed script. Albeit a quite sophisticated one ;-)
Angus