All pastes #347096 Raw Edit

Quiznos

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

[ -n "$*" ] && {
	if echo "$*" | egrep -q ' '
	then
		w=`echo "$*" | tr ' ' '-'`
	fi
	[ -f "$w*" ] && rm -v "$w*"

/bin/grep -hi "$*" *.b >$w.html

cat $w.html | 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
}