Jun 18
You may or may not know that Windows and Unix end lines in text files differently. Windows uses both a line feed and carriage return characters whereas Unix uses only the line feed character. This can be annoying if you’re working with documents on both systems interchangeably and you need to preserve a lot of indentation . One example for me is xml files I like writing them in a plain text editor because I cannot find an xml editor I get on with.
The solution is to use PERL:
- To convert Unix style line endings to Windows style
- perl -p -e ’s/\n/\r\n/’ < unixfile.txt > winfile.txt
- To Convert Windows style line endings to Unix style
- perl -p -e ’s/\r$//’ < winfile.txt > unixfile.txt
The use of single quotation marks in both command lines is important because it prevents the shell from trying to evaluate anything inside.
That’s it. A simple way to quicky convert line endings letting you get on with the job.
May 30
I dual boot a couple of my machines and whilst I was looking for a way to reapportion the size between two partitions I came across Gparted. It’s a Gnome based GUI for the GNU Parted program for creating, destroying, resizing, checking, and copying partitions, and the file systems on them.
What I really liked is there’s a linux livecd available so all you have to do is burn the disk image stick it in and aside from a few simple commands to boot the cd correctly it loads and starts Gparted.
Read the rest of this entry »
May 05
Ever needed to get rid of GRUB from a partition but didn’t know how? I managed to install GRUB onto my swap partition whilst setting up dual booting with Gentoo on a Mac Mini and faced this same problem. Using rEFIt it automatically detected GRUB on the partition and it showed up as a bootable option. I couldn’t be doing with that so I started looking for the solution. Loads of forum posts suggested fixmbr or fdisk but I didn’t want to replace GRUB I wanted shot of it. Anyway turns out the solution was to use dd.
# dd if=/dev/0 of=/dev/sdX bs=446 count=1
Where sdX is the partition to clean.
Jan 15
I’ve been looking for a way to start specific applications on specific desktops so things are more organized. For example I like to have my mail client (KMail) on the second desktop out of the way but there when I need it and I don’t like having to either start it in that desktop or move it to desktop two if I’ve had the application start automatically.
The utility to achieve this is kstart which is used to launch applications with special window properties such as to be full screen, below other windows or to not have an entry on the taskbar. The syntax is as follows;
user@host ~$ kstart [options] command
the specific argument (option) for my example is –desktop 2 and the whole command ‘kstart –desktop 2 kmail’ I’ve got mine set up as a .desktop shortcut in ~/kde/Autostart but you don’t have to have it there or use it in shortcuts it could be used in scripts or anywhere. I think this utility is great hence the post and hopefully it’ll take people less time than it did me to find the answer in future.
Recent Comments