corz.org text viewer..
[currently viewing: /public/linux/usr/local/bin/parse.sh - raw]
#!/bin/bash

#    parse    v0.1
#
#    I needed this to perform some funky operations on the slackware
#    package list, and though it's simple, quite limited, and fairly dumb,
#    parse has proven itself useful much more than once, especially for
#    creating ad-hoc uninstaller scripts from filtered finder results!
#
#    have fun!
#
#    (c) 2005 cor @ corz.org ;o) 

if [ "$1" != '' ]; then
    for lines in $(cut -d# -f1 $1)
        do
          $2 $lines
        done
    else
        clear
        echo
        echo " parse: do something to each line of a text file.."
        echo
        echo " usage:  parse <file> <command(s)>"
        echo 
        echo " ..will run through <file> and do <command> to each line of text in the file."
        echo " comments (lines beginning with \"#\") are ignored. note: if <command> is made"
        echo " up of multiple commands, enclose them in quotes.."
        echo 
        echo "   parse pkglist \"slackpkg search\""
        echo 
        echo " your results come back on standard output, do what you like with that.."
        echo 
        echo "   parse pkglist \"slackpkg search\" >> output.log"
        echo
        echo " here's something you can try at home, check on your LAN.."
        echo
        echo "   parse /etc/hosts \"ping -c 1\" >> lan-ping.log" 
        echo
        exit 0
fi

Welcome to corz.org!

Since switching hosts (I hope you are alright, Ed! Wherever you are …) quite a few things seems to be wonky.

Juggling two energetic boys (of very different ages) on Coronavirus lockdown, I'm unlikely to have them all fixed any time soon. Mail me! to prioritise!