All pastes #347354 Raw Edit

Quiznos

public text v1 · immutable
·published 2007-02-09 15:07 UTC
rendered paste body
#!/bin/sh -x
# find a word and save to file.

[ -n '$*' ] && {
w=`echo $* | sed -e 's/ /-/g'`
/bin/grep -hi '$*' *.b >$w.ix
cat $w.ix | gawk -v x="'$*'" '

function em(s) { printf( "<em>%s</em>", s) }

BEGIN {
	print( "<html>\n<head>\n")
	printf( "<title>Scripture Use of word: %s.\n</title>\n</head>", x)
	print "\n\n<body>\n<h1>Scripture use of word "
	em(x)
	print "</h1>\n\n<ol>"
}

$0 ~x {
	gsub( x, "<em>&</em>")
	print
}
{
	b=$1; cv=$2; $1=$2=""; a=$0
	printf( "\n<li value=%s>\n<a href=%s.html#%s>\n%s %s\n</a>\n", cv, b, cv, b, cv)
	printf( "%s\n", a)
}' | /usr/bin/bzip2 -v $w.html
}