Tag Archives: education

Convert multiple lines into one tab-separated line using paste

I generally have a lot of text files with such content:

1
Play track
Turn Around
Unlove this track
Panic Attack
Avinash Meetoo
110 scrobbles
2
Play track
Playing the Angel
Unlove this track
Precious
Depeche Mode
101
3
Play track
The Singles 86>98
Unlove this track
Personal Jesus
Depeche Mode
98

These are the three tracks I have listened to most since I started using Last.fm way back in 2005.

What I want to achieve is to easily convert these 21 lines (3 x 7) into 3 tab-separated lines which can then be easily imported into, say, Libreoffice Calc:

1<TAB>Play track<TAB>Turn Around<TAB>Unlove this track<TAB>Panic Attack<TAB>Avinash Meetoo<TAB>110 scrobbles
2<TAB>Play track<TAB>Playing the Angel<TAB>Unlove this track<TAB>Precious<TAB>Depeche Mode<TAB>101
3<TAB>Play track<TAB>The Singles 86>98<TAB>Unlove this track<TAB>Personal Jesus<TAB>Depeche Mode<TAB>98

For many years, each time I had to do that, I wrote a small Awk script. But, today, thanks to RudiC on the Unix Stack Exchange, I have the perfect recipe using paste:

paste -s -d "\t\t\t\t\t\t\n" file-containing-all-the-lines.txt

Naturally, you can adjust the number of “\t” if you have fewer or more fields.

Enjoy :-)

How to reduce the amount of disk space used by the systemd journal

We, Linux people, generally use systemd now and one of its components is the journal controlled by the journalctl command line tool.

As explained on the Arch wiki,

systemd has its own logging system called the journal. The /var/log/journal/directory is a part of the systemd package and the journal will write to /var/log/journal/

The journal is always appended and therefore grows in size. On my laptop, the journal was taking 1.8Gb of space and was full of details which, I believe, I’ll never need. So I decided to clear all old contents (which the systemd people call a vacuum). I issued:

journalctl --disk-usage
journalctl --vacuum-size=64M
journalctl --disk-usage

And the journal immediately became smaller. I then issued a

journalctl --verify

which made me realise that some of the remaining journal files were corrupted (for some reason). There is no journal repair tool in systemd so I simply removed the offending files (with rm).

Now, I can easily check my journal entries for today and I know everything will be all fine:

journalctl --since today

10 reasons why Linux is better than Windows for the Mauritian School IT Project

20030718-top-10

1) Linux is free !

Linux distributions can be obtained freely and copied at will.

2) Linux is open source !

The sources of Linux and thousands of other open source applications are readily available. Learning to build software becomes easy just by looking at those examples.

3) Linux has a community of users !

Linux is not only an operating system but also an extensive community of users willing to share experiences and support each other. The Linux User Group of Mauritius (www.linux.mu), among others, represents this community in Mauritius. Extensive user documentation created by fellow Linux users exists on the Internet (www.tldp.org).

4) Linux runs thousands of software !

A Linux distribution typically contains loads of software (e.g. Redhat Linux 9 comes with 1402 software packages) and many more can be obtained on the Internet (e.g. on www.freshmeat.net and www.sourceforge.net). Most of these software packages (e.g. productivity, graphical, educational, software development or Internet applications) are free.

5) Linux is robust, secure and efficient !

Linux has been designed to be very robust (it recovers gracefully from the whole range of exceptional situations), secure (every user can have private files and specific privileges) and efficient (it can be used on previous generation computers like 486s and Pentium I). Some very well-known companies now use Linux for their processing needs (e.g. Amazon, Google, the NASA, the CIA and even our own Mauritian Servihoo).

6) Linux is based upon open standards and open protocols !

Linux implements most open standards and open protocols including but not limited to TCP/IP, HTTP, MathML, PNG, SOAP, Web Services, XHTML, XML, XSL…

7) Linux is compatible with everything else !

Linux can easily coexist and work with all kinds of alternative operating systems systems (like Unix, Windows, MacOS…). Linux applications can also read and write files in proprietary format (like .doc or PDF). Linux can even run some Windows applications (most notably office applications).

8) Linux is an excellent environment to learn programming !

A Linux distribution comes with numerous software development environment and compilers (for C, C++, Java, Python, TCL/Tk, Fortran, Ruby…).

Java 2 Enterprise Edition is also available through the freely available J2EE implementations from Sun or JBoss. With the availability of the two leading open source databases in most distributions, PostgreSQL and MySQL, a student has all the tools required to learn to build extensive enterprise software applications.

9) Linux can be easily administered remotely !

Every computer running Linux can be administered remotely using the very secure SSH protocol. This means that all eventual maintenance and installations can be done remotely. This implies that every school need not have a local system administrator.

10) Linux is being promoted by some very well-known companies !

IBM (www.ibm.com/linux), HP (www.hp.com/linux), Oracle (www.oracle.com/linux), SAP (www.sap.com/linux), Sun (www.sun.com/linux) and other well-known companies are heavily investing and developing products for Linux.

This clearly shows their trust in Linux.

Linux is the future !

Thanks to all those who have contributed ideas and to Yash Nursinghdass in particular.

Copyright Avinash Meetoo | Published under the Gnu Free Document License