HowTo: Convert Between Windows & Unix Line Endings Using PERL

Linux, Mac, Windows No Comments »

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.

Real-Time Images & Movies of the Sun

Miscellaneous No Comments »

Our Sun on 20080617

The other week I found the NASA site for the Solar and Heliospheric Observatory through someone else’s blog (cannot remember who though). Anyway I think it makes a good bookmark especially the real time images and movies.

I thought they were neat and so might you.

Getting Margin:Auto; To Work in Internet Explorer

Blog Stuff, Windows 1 Comment »

I’ve been doing a bit of web design in my spare time lately and before long I came across the issue of using margin: auto; in my stylesheet not working in internet explorer. Meeehhhh! I couldn’t be doing with that and given that the best way to attack an unknown problem is to search for knowledge I hit google (not literally of course).

Turns out, that you can force Internet Explorer (and other browsers) to parse your cascading style sheets strictly by using a strict doctype definition. I used the one below for my project;
Read the rest of this entry »

WP Theme & Icons by N.Design Studio | Akismet has gobbled 358 spam comments...Mmmm Tasty :-)
Entries RSS Comments RSS Log in