Wednesday, October 22, 2008

Difference between TRIMSPOOL and TRIMOUT

SET TRIMSPOOL ON
Determines whether SQL*Plus allows trailing blanks at the end of each
spooled line. ON removes blanks at the end of each line, which may
improve performance especially when you access SQL*Plus from a slow
communications device. TRIMSPOOL ON does not affect terminal output.
SET TRIMOUT ON
Determines whether SQL*Plus allows trailing blanks at the end of each
displayed line. ON removes blanks at the end of each line, which may
improve performance especially when you access SQL*Plus from a slow
communications device. TRIMOUT ON does not affect spooled output.

Tuesday, October 21, 2008

How to delete many files ending with an extension?

Some times you cannot rely on ‘rm’ command for deleting huge number of files. Even ‘-f’ switch will fail you. In those situations the following command can be used.

find . -name '*.ext' | xargs rm

How to edit a read-only file (eg. /etc/hosts)

You do not need to change the access rights in /etc/inet/hosts
Logged in as root, the file is read only, but since you are root, you can make changes to the file. Just make sure when you get done editing the file (yes it shows up as read only, but don’t let that fool you)
you type
:wq!
You are forcing an over write of the file.
Remember as root/su you have rights to everything, so make sure that you do not make a mistake. Always make a backup of what you are working on before you make the changes.

How to remove last line of a large file

I need to remove last line of a file that is very very huge.

sed '$d' infile > outfile

copied from here