Concatenating a list of files in bash
Posted on 7th May, 2010, under the categories aside and bash. View comments or add a comment. Permalink
I had the need to concat a list of files like this:
~/Downloads
file_1.001
file_1.002
file_2.001
file_2.002
file_3.001
file_3.002
file_4.001
file_4.002
The command to concat the files individually would be:
$ cat file_1.00* > file_1
But to do it individually would take a while. Luckily, a simple bash script did the trick:
for f in $(ls *.001); do
target=${f%.*}
catname=".00*"
cat $target$catname > $target;
done
Older Entries
MATLAB Tricks
Posted on 7th March, 2010, under the category matlab.
MATLAB has become part of my life recently. As I used it more often, I realised that there were a few things I needed to do that required scripting in MATLAB. For example, I wanted to create same-sized .eps figures for my research project, or be able to reorder the legend for graphs.
Continue reading
A Simple Python GUI App
Posted on 10th January, 2010, under the categories gui, python, sqlalchemy, and wxpython.
A big part of my internship at Airbus was to do with creating an application that would run on Windows. I remember dabbling in wxPython and matplotlib, and the end product was something that resembled a traditional desktop application. Whether it went to production or not, however, is a question that I probably will never be able to answer, but I diverge. I discovered that I can claim a bonus 5% in my design project if I did something ‘extra’. That something extra is a simple application that takes in a few inputs and outputs a graph.
Continue reading
Using MATLAB to Control Simulink
Posted on 13th November, 2009, under the category matlab.
The final year of university is taking its toll on me. The act of balancing a research project, a team design project, several reports, numerous job applications, and MSc applications has took all my time away. Fortunately, there’s still a little glimmer of hope in all that work – in the form of MATLAB.
Continue reading
git and fabric
Posted on 22nd October, 2009, under the categories django and git.
I have been a Subversion user for a while, and I wanted to learn another version control system. I chose git. From the start, I found converting to using git a pleasure. There are plenty of guides out there to get you started. In this entry, I will talk about how I used git to store my blog’s code. In addition, I will talk about fabric, an excellent automation tool for deploying your website to multiple servers, but works just as well if you are only doing it to one.
Continue reading
Furthering A Simple Django Blog
Posted on 26th September, 2009, under the category django.
The last entry talked about using virtualenv, simple git commands, and a simple model and URLconf for the blog application. This entry will focus on Django contrib packages, which provide free RSS, a sitemap, generic comments, and many more.
Continue reading
A Simple Django Blog
Posted on 15th September, 2009, under the category django.
I developed a simple Django application that powers kennethkam.com. This entry will describe the workflow I used, from using git as my repository, using fabric for deployment, and various Django apps that can be used to plug straight into your project. This first entry will focus on using virtualenv, git, and knocking up a simple blog while the second one will focus on Django contrib packages, more git topics, and Fabric.
Continue reading
Django Powered
Posted on 8th September, 2009, under the categories django and personal.
Welcome to my humble blog. If I recall correctly, this is my fifth attempt at writing a blog. The first blog was powered by WordPress and it was laden with teenage angst; the second one was also powered by WordPress, but I fail to recall what I wrote about; the third one was also powered by WordPress, and the topic was more football than teenage angst. The last blog aimed at documenting my internship at Airbus UK, but feeble efforts resulted in sporadic entries, which resulted in a blog that didn’t have much to offer.
Continue reading