fixhist.sh - fix the B news history file - see mkhistory.c
tektronix!zehntel!sytek!menlo70!hao!seismo!uwvax!solomon
tektronix!zehntel!sytek!menlo70!hao!seismo!uwvax!solomon
Fri Mar 25 16:10:42 AEST 1983
#!/bin/sh
# Fix /usr/lib/news/history to truncate names in it to 14 characters, so
# that it will be directly comparable to the output of mkhistory for
# the sake of comparison. Also sort the list of file names on each line.
awk '
BEGIN { FS = "\t" }
{
nfiles = split($3,fnames," ")
printf "%s\t%s\t", $1, $2
for (i=1;i<=nfiles;i++) {
slash = index(fnames[i],"/")
if (slash <= 14)
name[i] = fnames[i]
else
name[i] = substr(fnames[i],1,14) substr(fnames[i],slash)
}
if (nfiles==1) printf "%s ",name[1] # special case for efficiency
else
while (nfiles > 0) {
pos = 1
for (i=2;i<=nfiles;i++)
if (name[i]<name[pos]) pos = i
printf "%s ",name[pos]
for (i=pos+1;i<=nfiles;i++) name[i-1] = name[i]
nfiles--
}
printf "\n"
}' </usr/lib/news/history
More information about the Comp.sources.unix
mailing list