Wednesday, February 2, 2011

2) Solution for ^M characters


If you deal with DOS files and the "^M" character always appears at the end of the line, here is a command
provided in SCO-UNIX.

dtox -- change file format from MS-DOS to UNIX

From a Unix shell use the command:
$dtox filename > output.file

Other flavers have similar commands: dos2unix or to_unix

$dos2unix filename output.file

Check your man pages ont he flavor you use. If you have whatis set up. Use a

$man -k dos

1) Use of Alias

The following alias will list just the directories in a directory and not other ordinary files. It will list a directory as a directory even if the directory is a symbolic link.

alias dir='ls -Lla|grep ^d'

Without the capital "L" in this alias, the alias will not list directories that are symbolic links.

For using this alias every time, put this command in your ".profile" file in the Home directory.

Another example, suppose you have to go to some logs directory very frequently, which is say something like this:

/siebel78/siebsrvr1/siebsrvr/enterprises/ABCDE/server1/log

You can make an alias,
alias golog='cd /siebel78/siebsrvr1/siebsrvr/enterprises/ABCDE/server1/log'

and then use this alias from anywhere from the server to go to the Logs directory.