I'd love to see an Intro to Linux (way more than just install) as a 3-hour workshop at #CSTA14 @csteachersa— Steve Keinath (@keinath) November 12, 2013
@alfredtwo @csteachersa Right. I know very little & would love a "zero to hero" Linux workshop.— Steve Keinath (@keinath) November 12, 2013I briefly considered proposing a session for the conference but it was just a day or two before the deadline, I don't know if I'm going to be able to attend the conference, and besides, who said anything I proposed would be accepted. Still, I liked the idea - I've been an educator for 23 years, a Linux user for most of that time and an Unix user for longer. I'm a firm believer in operating system as toolkit and so I think I'll take Steve and Alfred's suggestion and try to put together a series of posts on using Linux from a CS educators point of view. So, before we begin - a little background. I can proudly say that I've been Windows free since about 2000. That's when I decided to wipe the lat traces of Microsoft from my hard drives. Prior to that I just booted up MS-DOS or Windows to play games or to use a Excel or Word. Since the early days of Linux - back before Slackware, I dual booted. Before Linux, I dialed into public Unix systems such as Panix or The Big Electric Cat. At home, I tried to make MS-DOS as Unix like as I could. I ran the MKS Toolkti, and used my own shell (a project every young programmer should attempt). Why am I posting this now? It's a new semester and I find myself, as usual, leveraging the Linux shell. It was time to set up a mailing list for the class. I'm able to go to our school's data system and grab a tab delimited file that looks something like this:
Code Section Period Last First ID Official Advisor OSIS Email grY22tBs 01 6 Hxk Blu GFy 9272 7rr gEs 274989649 zlu3lxk@QylKR.oqy grY22tBs 01 6 HiQqvlRu Blku 9918 7PP YHZHm 200878353 email@example.com grY22tBs 01 6 plxk ClSKv 9226 7II PHXrNY 274661826 olxkvl@QylKR.oqy grY22tBs 01 6 pxKk BqVxFl 9026 7II PHXrNY 224608174 zo6461@lqR.oqy grY22tBs 01 6 pqxuk NRK 9234 7dd gHAMmNd 270217219 uRKo90@QylKR.oqy
It’s tab delimited but I scrambled the letters so as to not reveal any student info.
Oh, how did I do that scrambling? Easy. First, I combined some basic utilities to make a random permutation of the upper and lower case letters and stored them in a shell variable. Don’t worry, I’ll explain these commands in upcoming posts:
perm=`echo "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ | sed "s/\(.\)/\1\n/g" | sort -R | tr -t "\\n" ":" | sed "s/[^a-zA-Z0-9,@]//g"`
Then I used tr (translate) to exchange the real letters for the matching letter in the random permutation:
cat students.tsv | tr a-zA-Z $perm > students.scrambled
So back to the real work. I needed to isolate the students email addresses. The process:
- convert the tabs to commas
- Pull out the students in my AP class (code MKX22X) from the list of all students
- Pull out the 10th column
- These are the emails, save them to a file
So, I typed:
cat students.tsv | grep MKS22X | sed “s/\t/,/g” | cut -d, -f10 > emails
grep filters out lines that have MKS22X in them and sed replaces the tabs (\t) with commas and cut pulls out the email addresses. It’s all stored in a file named emails.
Now, I just have to import these into my maillist software (mailman).
add_members -r emails myclasslist
So, that’s it, easy peasy.
I’ll be away for most of this week at the Tapia conference and then I’ll be playing catch up, but I’m hoping to do a series of posts talking about my Linux toolset and how I use it.
I hope you all find it interesting and maybe even useful.Tweet