huntnw/huntnw

12 lines
474 B
Plaintext
Raw Normal View History

2020-03-18 22:25:24 +00:00
#!/bin/bash
QUERY=`echo $1 | tr ' ' ' ' | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g'`
2020-03-18 22:25:24 +00:00
2020-05-05 23:45:43 +00:00
for fn in `grep -rEic $QUERY content | grep -v ':0' | sort -t: -nrk2 | awk -F: '{print $1}'`;do
2020-03-19 00:02:21 +00:00
PA=$fn
2020-03-19 13:08:50 +00:00
echo "<div class='box'><a href='"`head -n 2 $PA | tail -n 1`"'>"`head -n 1 $PA | head -c 30`"</a><p>"`grep -i $QUERY $PA | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g' | head -n 2 | head -c 100`"</p></div>"
2020-03-18 23:18:38 +00:00
done
2020-03-18 22:25:24 +00:00