On 2019 Mar 18 17:25:58, you wrote to me:
I'll probably post 50 random taglines in each post. Gotta keep people wanting more... :)
here's my posting script... it breaks the input file out into separate files for posting... it is using hpt on this system to create the posts from the individual files... the NUMLINES variable at the top is the number of lines per
file the input file will be broken into... as with the previous script, it expects the input file's extension to be .txt...
this one is 59 lines long and i know that wordwrap will bite it fairly hard... hopefully it won't be so bad it can't be fixed...
==== Begin "posttaglines" ====
#! /bin/bash
NUMLINES=500
printf "\n"
printhelp() {
printf "just tell me the tagline file to post (without extension)\n"
printf "and the base file name of the parts to be posted.\n"
printf "\n"
printf "eg: posttaglines alltags.sorted.uniq foo\n"
exit
}
case "$1" in
"" ) printf "ERROR: no tagline filename given.\n";
printhelp;;
esac
case "$2" in
"" ) printf "ERROR: no base parts filename given.\n";
printhelp;;
esac
if [ ! -e $1.txt ]
then
printf "ERROR: file $1.txt not found.\n"
printhelp
fi
if [[ -e $2aa ]]
then
printf "Cleaning up previous $(ls -l $2* | wc -l | cut -d" " -f1) $2* files\n"
rm $2*
fi
printf "$(wc -l $1.txt | cut -d" " -f1) lines in $1.txt\n"
printf "splitting into files containing $NUMLINES lines each\n"
split -l $NUMLINES $1.txt $2
TOTALFILES=$(ls -l $2* | wc -l | cut -d" " -f1)
printf "$TOTALFILES $2* files to post\n"
COUNTER=0
for a in a b c d e f g h i j k l m n o p q r s t u v w x y z
do
for b in a b c d e f g h i j k l m n o p q r s t u v w x y z
do
if [ ! -e $2$a$b ]
then
break
fi
((COUNTER++))
printf "posting file $COUNTER of $TOTALFILES - $2$a$b - $(wc -c $2$a$b | cut -d" " -f1) bytes\n"
printf "hpt post -nf \"mark lewis\" -af \"1:3634/12.73\" -nt \"all\" -at \"1:3634/12.73\" -s \"[AUTOPOST] Taglines $COUNTER of $TOTALFILES (max $NUMLINES lines per post)\" -e \"taglines\" -o \"\" -f loc $2$a$b\n"
~/fido/bin/hpt post -nf "mark lewis" -af "1:3634/12.73" -nt "all" -at "1:3634/12.73" -s "[AUTOPOST] Taglines $COUNTER of $TOTALFILES (max $NUMLINES lines per post)" -e "taglines" -o "" -f loc $2$a$b
done
done
printf "\n"
==== End "posttaglines" ====
)\/(ark
Always Mount a Scratch Monkey
Do you manage your own servers? If you are not running an IDS/IPS yer doin' it wrong...
... Every person you meet knows something you don't. Learn.
---
* Origin: (1:3634/12.73)