All that can be ‘sed’

Today was working on the joys of multi-threading a renderer. Which is actually rather complicated. The good news is that after a fairly long battle all is mostly working. I reckon another day should shift it, although how much of a speed gain it’s going to be is yet to be determined.

Ordered bar stools.

Went to the gym and did spin. It’s with a guy called Paul who think’s is American in the same way that Tim Westwood thinks he’s black. He only knows two sentences, ‘Tap it up’ & ‘Sprint’. I popped into Tesco’s on the way back and picked up some corks and sterilizer. Also some paint for the coving.

Did some more work, then transferred the red to the other bucket. Started the white off, needs to come up to temperature first.

Sampled the red, it isn’t bad, pretty drinkable.

Then I started playing with a little linux pet project. I want to get the IP address from a mail log for a certain user, but I want it to be the most recent entry. And I want to do it using only command line utils…okay one step at a time. First lets just get all strings associated with this user. So start with ‘grep’ then, so ‘grep user=tim mail.log’. Sorted, now have an output of every line for that user. Okay, now only want the latest entry, so we’ll pipe that to tail. ‘grep user=tim mail.log|tail -n 1’ sorted, that gives me one line. That line looks like this though ‘Nov 8 18:58:03 mannmansion pop3d-ssl: LOGOUT, user=Tim, ip=[::ffff:192.168.0.0], port=[65568]’ etc. So now lets get rid of the front bit up to the ‘ffff:’, ‘grep user=tim mail.log|tail -n 1|sed ‘s/^.*::ffff://’ and that gives you the output ‘192.168.0.0], port=[65568]’. Now let’s get shot of the end bit, “grep user=tim mail.log|tail -n 1|sed ‘s/^.*::ffff://’|sed ‘s/].*//'” and finally you get the output ‘192.168.0.0’. I’ll work out what to do with this exciting information tomorrow.

Leave a Reply

Your email address will not be published.