Browsing all articles from January, 2010
Jan
4

Using Perl to Replace Text in Multiple Files

You can search and replace text inside multiple files using Perl. This is how you do it:

$ perl -i -pe 's/Windows/Linux/;' test*

This command will search for the word ‘Windows’ inside all files that begin with ‘test’. When it finds one, it will substitute it with the word ‘Linux’. This is useful if you have multiple files that contain the same text. Remember that you can use regular expressions to make searching flexible.

Jan
3

VIM Trick: How to Comment Multiple Lines

If you need to comment out lines of text inside VIM, you can try this trick:

(Enter command mode in VIM)
:40,105s/^/#/g

This will insert the # character at the beginning of each line starting from line number 40 to line number 105.

If you cannot see the line numbers, do this:

(Enter command mode in VIM)

:set number

To remove the lines:
:set nonumber

This is quite handy if you need to comment out lines of codes in a script.

Jan
2

Backspace Key Not Working in PuTTY

Author Rai    Category Linux     Tags , , , , , ,

If you access your Linux machines from a Windows workstations by SSH, most probably you are using PuTTY. My new job requires me to work with SUSE Enterprise servers and to my surprise, the VIM on SLES is somewhat different from that of RHEL.

One example is the backspace key. It just won’t work in PuTTY connecting to SUSE server. I have to put the cursor before the character I want to delete and press the DELETE key. If you have this issue with PuTTY/SUSE too, this tip might help you.

Go to your PuTTY configuration -> Terminal -> Keyboard

Look for Change Sequences Sent By -> The Backspace Key

From there, select Control-H. Save your session and try it.

This one worked for me, hope this works for you too.

Jan
2

PinoyTux is Back

After several months of hiatus, I decided to start the year by making PinoyTux active again. There is too much going on with my personal life so blogging became part of my unimportant list. But just like a phoenix, PinoyTux is reborn from the ashes and prettier than ever.

The last theme I used did not go along with my blog. The images are stretched out, the header is messy, and the footer contains suspicious outgoing links. I have decided to find new one. The here we are. A few easter eggs were thrown in as well. If you take a look at the header logo, the Tux image changes randomly with every page refresh. It is a little hack I found while searching for fun themes. I also added a link to my Plurk and Twitter accounts at the right panel to make it easier to connect to me.

There is also a craze going on named as Project 365. Originally, Project 365 is meant for photos, just like a photographic journal, and Photojojo writes about it and gives a few tips on how to survive.

The idea of Project 365 became familiar to me when I watched the movie “Julie and Julia”, where Julia (played by Amy Adams) blogs about her experiences as she tries all recipes in Julia Child’s (played by Meryll Streep) book of French cooking. I thought that it was a splendid idea to write about something that has a goal, something that is achievable.

For Pinoytux, photos are not really the subject matter, but I have decided to put a mini-365 Project of Linux tips and hacks. One tip a day, and it will have its own category so I can track my progress. There will be separate posts for other stuffs so expect my blog to be alive and kicking again.

With my new job, I know that I am going to be very busy, but I hope I can take one moment each day to write at least one tip for my readers. If I can make it in December, it will be huge success for me.

Powered by 1and1.comGlobat Webhosting Earn with Your BlogAdvertise @ PinoyTux

Search PinoyTux

Subscribe to Email Feeds

Enter Email Address:

Blog Lounge

Popular Posts

Recent Posts

Drop your Card Here

Recent Comments

Site Stats