Geeky Christmas – Week 44

If you survived last week’s mini-geek-fest, then this one may do you in! This is another script used in conjunction with the punctuation parser from last week that I use to manage my recording schedule.

It will ask for the text file you wish to manipulate and get the due date for the recording, then split that text file up into equal size chunks with sub-project due date for milestones that will keep you on a steady flow for completing the entire manuscript.

todayepoch=$(date +%s)
echo Today is $todaydate which is epoch $todayepoch
echo What file do you want to work on?
read textfile
echo What Project ID is this for?
read pid
touch $pid.sql

#get due date in mm/dd/yy
echo Due date in mm/dd/yy?
read duedate

# convert to epoch
dueepoch=$(date +%s –date=$duedate)
print duedate and dueepoch
echo Due date is $duedate which is epoch $dueepoch

#calculate and print how many days, weeks, months to duedate
echo $epochsleft “seconds left to finish.”
echo $daysleft “days left to finish.”
chunks=$weeksleft #Default unless days overrides
milestoneratio=604800 #Ditto
echo $weeksleft “weeks left to finish.”
echo $monthsleft “months left to finish.”
if [ $daysleft -lt 14 ]; then echo Less than two weeks. Figuring by day.; chunks=$daysleft ; milestoneratio=86400 ;
elif [ $weeksleft -lt 5 ]; then echo Less than one month. Figuring by weeks.; chunks=$weeksleft; milestoneratio=604800 ; fi
echo $chunks time chunks remaining.
echo $milestoneratio is your epoch length per chunk.

#get hours in book
totalwords=($(wc -w $textfile))
echo $totalwords total words in file
totallines=($(wc -l $textfile))
echo $totallines total lines in file.

#calc lines per day
echo You need to do $linesperday lines every day and $linesperweek every week.

#calc lines per chunk

#calc and print weekly due dates
while [[ $i -le $chunks ]] #chunks replaced weeksleft for daily iterations
((milestone=$todayepoch+imilestoneratio)) #milestoneratio replaced 604800 for daily interations milestonedate=$(date +%D –date=@$milestone) ((milestoneline=i$linesperchunk)) #linesperchunk replaced linesperweek for daily
echo Week “$i” $milestonedate $milestoneline
echo Week “$i” $milestonedate $milestoneline >> $pid.sql
sed -i “${milestoneline} i Milestone ${i} You should be here by ${milestonedate}” $textfile

sed -i ‘/Milestone/{G;G;G;G;}’ $textfile

Categories: Business Development, SoftwareTags: , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s