shithub: sm2

ref: f67009a6af1a85ec5aac543ca3e0e06db1911d37
dir: /bin/sm2ger/

View raw version
#!/bin/rc -e
p=$home/p/sm2/ger
cd $p || exit
awk -v 'nword='15 '
{
	d[NR] = $0
}
END{
	if(length(d) == 0)
		exit
	srand()
	for(i=1; i<=nword; i++){
		do
			x = int(rand()*1e6) % length(d)
		while(! (x in d))
		h[i] = d[x]
		delete d[x]
	}
	for(i in h)
		print h[i] >>"db0"
	for(i in d)
		print d[i]
}' db >/tmp/sm2.$pid
mv /tmp/sm2.$pid db
sr3 db0 >db1
#mv db1 db0