![]() The for command looped through that list, assigning the name of a month directory to the variable d each time through the loop. In this command, the backticks around the first ls executed that command, which gave a list of the month directories. October and November were a real dropoff. ![]() Which looped through all the month directories, got the number of files in each, and printed them out, each month on its own line. For that, I ran this command: for d in `ls` do echo -n $d ls $d | wc -l done This is nice for the total, but it doesn’t say much for how the posts were distributed throughout the year. The list is then piped to wc, which, when given the -l switch, prints out just the number of lines of its input. The ls command lists all the files that are one subdirectory deep, one per line. With this organization scheme, I cd‘d into the 2015 directory and used this command to get the total number of posts for the year, which is 133: ls */* | wc -l Where the tilde is shell-speak for my home directory. For example, the source for this post is in a file called ~/Dropbox/Elements/all-this/source/2015/12/year-in-review-in-shell.md ![]() The Markdown source files are kept in a Dropbox directory called source, with subdirectories for each year and sub-subdirectories for each month. I don’t keep track of stuff like that ( this experiment with Piwik didn’t last long), but because ANIAT is a static site organized through a hierarchical folder structure and built from Markdown files, it’s easy to summarize the posts themselves though Unix shell tools. This is the traditional time for bloggers to look back over the year and give statistics on pageviews, most popular posts, and things like that. Next post Previous post Year in review in shell ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |