Weekly tweets!

  • Weekly tweets! http://ff.im/-sA7su #
  • Spent 11 hrs on the train this weekend. Very impressed by how my Kindle kept me occupied. Did not not even have my obligatory train beers. #
  • Me too! RT @TonyChurnside: I always wanted to buy a boat: http://j.mp/b4jqzLhttp://j.mp/b4jqzL #
  • 3 days into being a Kindle owner and I like it a lot. Still with an RSS reader and Evernote integration it would be damm near perfect! #
  • Finally watched final ep of The Wire S04 last night. Very good, but sad to see Bodie go. Nicely setup for S05. Cannot wait. #
  • Save our forests for future generations… http://bit.ly/a2J1cE ..and us of course! #
  • Apologies to any followers and FB friends for SPOILERS of the Wire. I removed the comment. How dumb am I? #
  • I wonder what the real truth about this is http://bit.ly/brvP4h Bit harsh if they did get away with it. #
  • No more sewage (at least in the garden!). http://ff.im/-sOmMW #

removing a file extension from a bunch of files

During my Ph.D. I used a VMS machine with GCG a great deal. Not a powerful machine by any stretch of the definition but it was there, accessible and had a copy of GCG with updated databases.

VMS has more than a few differences when compared to UNIX. A great feature is filesystem level versioning.All save operations will create a new version. Edit a file called “mess” and upon saving you will now have “mess;0” and “mess;1”. Edit it a subsequent time and you have “mess;2” and so on. This is a great way to fix a problem if you messed up editing it, Although having all those files in a directory does get a little annoying. I guess that the shell allowed you to only display the most current revision of a file but I never got around to finding how!

Anyway I recently had cause to revisit a bunch of sequences from my Ph.D. days and had to get rid of the extension of a whole bunch of files (a few thousand). Performing rename operations under UNIX is always a pain in the arse. Linux has the rename command which makes this easier (remember rename is just a mv), but I was doing this from OS X which has no such command. Normally when I come across such a missing app under OS X I’d use Fink to compile and install a missing command, but it seems there’s no package for it.

Basically I needed to do the following operation on many files:

mv './INTERESTING.LIST;4' './INTERESTING.LIST'

However that ;4 could be any digit from ;0 to ;10 depending how many times I’d edited the sequence under VMS.

For such renaming operations I would use ‘find’ and ‘xargs’, however, for the life of me I could not get it to work.

In the end I settled for the following command. It’s quite an elegant solution as it uses echo to send the substituted command through sed to remove the version number from the second iteration of the found file, and then pipe this through to the shell to execute it..

find . -name "*;4" -exec echo "mv '{}' '{}'" \;

sed 's/\;4//2'

The full command is:

find . -name "*;2" -exec echo "mv '{}' '{}'" \;| sed 's/\;2//2' | /bin/sh

I found this in a post on the Macworld Forums.

Of course if I had have been clever I’d have run this in a shell loop to perform for each digit. However, I’d wasted too much time as it is and I just ran the command ten times.

Technorati Tags:

Weekly tweets!

  • Weekly tweets! http://ff.im/-rOZEX #
  • Fire http://post.ly/13HOh #
  • Listening to Melon Collie & the infinite sadness. It's a pretentious album, but I'd forgotten just how good it is. #
  • Fire http://ff.im/-rPxZi #
  • my early evening snack was maroilles on toast. I pity people sat next to me in my French class. #
  • It's depressing to read about the nine babies dead in California because anti-vaxers are selfish and stubborn http://bit.ly/9oeUFm #
  • Last throes of Summer. http://post.ly/13VYh #
  • when you get a phone call that starts "this is a free.." do you ever get beyond the "free."…? #
  • Last throes of Summer. http://ff.im/-rS814 #
  • Anybody using the forked (by the vendor) V4L drivers for the TBS6980 on kernel 2.6.34? #
  • Human Fly – The Cramps on Radio6 now. Might go sniff some glue. #
  • I put sweet chilli on my quesadillas by mistake. Quickly rectified by the addition of Encona hot pepper sauce! #
  • T'owd Lamacq is good today. New Order, The Fall, The Smiths etc….. Some shite about Manchester though. #
  • Looking forward to the Apple Pressing day in #horningsea tomorrow! #
  • I have lived the first half of XKCD so many times until I learnt to say yes to the first 5 questions http://xkcd.com/806/ #
  • Burrito from @nannamexico for lunch. Yumscrum. #
  • I wish I was at #tamlondon but am instead doing low tech with a village apple pressing day in #horningsea #
  • Asparagus in seed http://post.ly/154Zb #
  • Asparagus in seed http://ff.im/-sc6tr #

Weekly tweets!

  • roast pork in the oven, with crackling. Shame the sun has come out as that dish needs howling rain to be appreciated. #
  • Error 500 when installing MacVector http://ff.im/-ruskM #
  • so full of roast pork and crackling etc.. Now for "This is England 86". Got the whole series recorded waiting! #
  • & a wafer thin whisky to wash down the roast dinner! #
  • My Blenheim Orange apples are ready. Yummy scrummy. #
  • I've finally sussed how to pronounce 'u' in French. It's the same as the 'e' in the English word 'pew'. #
  • Stop by the MacVector booth #802 at the NIH Research Festival next week! http://ff.im/-rx8Wn #
  • A day messing with phpbb and WordPress. #
  • French class was good this evening. #
  • If you want to save #Xmarks and are willing to pay then go here http://bit.ly/a50Ljq #
  • Finally! RT @PaulOBrien: Skype is in the Android Market! (thanks @Amon_RA for the heads up!) #
  • I fitted my kneelin thwart to the canoe last night. Shame there's too much rain to go paddling today! #
  • ..which is ironic considering when I was younger and a white water kayaker I would only go on rivers that needed days of rain to get going! #
  • Cameron does ginger jokes. #
  • Now Cameron does fat jokes…. #
  • It's a bit cold today. First day of winter. Sunny though. #
  • My espresso maker is unrepairable. Heartbroken. Need new one quickly.! #
  • Recommendations for a 15 bar "pod-free" espresso machine? Not bothered about looks. Bothered about the coffee. #
  • Log insulation [pic] http://ff.im/-rIdNb #
  • I rarely see canoes on the river but 21 boats just gone past! #
  • A Hercules just flew over. It looked close enough to almost touch! #
  • Nice. Looks like #xmarks is not going to die http://bit.ly/98gd3B #
  • Hey Guardian. Do not pollute my Saturday newspaper with your DRM protected crap "free offer". #
  • Well at least the Guardian's free offer will run on Flash on Linux, so I can watch it on my telly. #
  • Getting in early it's 9:56, 10/10/10. #
  • BLOGGED: my office has a new coat http://bit.ly/cirDrU #
  • My shed office has a new coat! http://ff.im/-rNPyz #

Weekly tweets!

  • After holidays this drizzle is bringing me down. #cambridge #
  • Xmarks is closing. Shame I liked that service http://bit.ly/9z6Iqy #
  • My current fave lunch food. Wraps with cheese and rough pate, blasted for 30 secs in the microwave. yum! #
  • With a heavy heart I'm packing the shorts away from holiday. I doubt I'll be wearing them before the goose! #
  • Awake too bloody early #
  • Wonder of Wonders I can see sunshine outside #
  • Appalling. Know where your fish comes from? RT @rowanNS: 'Modern-day slavery' uncovered on trawlers fishing for Europehttp://bit.ly/bRTolv #
  • Sunny garden http://post.ly/10or3 #
  • IMG_20100919_205611 [pic] http://ff.im/-rlPNp #
  • Trying to put up a bloody shelf but feel rubbish. I think I may stop before I put a screw through the power cable 😉 #
  • Interesing that Mad Men is off to Sky after this season (which I've not started). In S01 nobody even knew it existed. Slow burner indeed! #
  • DIY'ing shelves on a Friday night with Love – The Cult. Old fart? Fuck yeah! #
  • A holiday in Italy has inspired me to make some pizza dough. Just the dough mind, no wood fired oven in the garden yet. #
  • Just watched "the Road". Hard film to watch but very, very good! #
  • Looking forward to Mythtv .24 with Bluray disc support! #
  • migrating kernels from 2.6.31 to 2.6.35 on a gentoo HTPC. Lots of new drivers in there. Make oldconfig is proving lengthy. #
  • hitech baking… My pizza dough is rising in my server rack sat on a switch. warmest place in the house. #
  • Just heard "town to town" – microdisney on BBC6. Awesome. Not heard that for ages. http://youtu.be/VFXheatfJ7E #