huntnw 384 B

123456789101112
  1. #!/bin/bash
  2. QUERY=`echo $1| sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g'`
  3. for fn in $(grep -rEic "$QUERY" index | grep -v ':0' | sort -t: -nrk2 | awk -F: '{print $1}');do
  4. PA=$fn
  5. echo "<div class='box'><a href='$PA'>$PA</a><p>"`grep -i "$QUERY" $PA | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g'`"</p></div>"
  6. done