File:  [Research Unix] / researchv10no / ipc / mgrs / ns / mkdb / merge.sh
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:34 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

echo merging $1 1>&2
sort -n | awk '
#
#	merge all lines with equivalent leading ids
#
BEGIN {
	line = ""; id = 0; last = ""
}

{
	#
	# skip duplicates
	#
	if($0==last)
		next;
	last = $0;
	if($1 != id){
		if(line!="")
			print line;
		id = $1;
		line = $2;
	} else
		line = line " " $2;
	for(i=3; i<=NF; i++)
		line = line " " $i;
}

END {
	if(line!="")
		print line;
}
'

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.