view paste/paste.6763 @ 9554:23f43464694e

<Zarutian> le/rn Frams\xc3\xb3knarflokkurinn/A, now defunct, political party in Iceland. Like its sister party Sj\xc3\xa1lfst\xc3\xa6\xc3\xb0isflokkurinn it is named by the antonym of what it is. (The name means the Progressive Party but they have nearly always been highly regressive). Think dumb Hill-Billies in ill fitting suits and you get their constiuents.
author HackBot
date Sun, 30 Oct 2016 14:33:24 +0000
parents 84da026b16a5
children
line wrap: on
line source

#!/bin/sh
cd /var/irclogs/_esoteric

pasterandom() {
    if [ "$1" -gt 150 ]; then
        echo "No."
        exit
    fi
    for i in $(seq "$1"); do
        file=$(shuf -en 1 ????-??-??.txt)
        echo "$file:$(shuf -n 1 $file)"
    done | paste
}

if [ "$1" ]; then
    if expr "$1" + 0 >/dev/null 2>&1; then
        pasterandom "$1"
    else
        lines=$(grep -P -i -- "$1" ????-??-??.txt | head -n 301)
        {
            echo "$lines" | head -n 300
            [ $(echo "$lines" | wc -l) -eq 301 ] && echo "[too many lines; stopping]"
        } | paste
    fi
else
    pasterandom 40
fi