Archive for April, 2010

தமிழ் புத்தாண்டு

ஒவ்வொரு தமிழ் புத்தாண்டும்
நீ என்னிடம் உன் காதலை சொன்னதையும்
நான் நிராகரித்ததையும் மறக்காமல் நினைவு படுத்துகின்றன
இந்த நினைவுகளை சுகம் என்பதா இல்லை வேதனை என்பதா 
ஏன்னா சத்தியமா நான் உன்னை காதலிக்கல
தமிழ் புத்தாண்டு நல்வாழ்த்துகள் 🙂
Categories: காதல்


iconv – convert from one encode to another encode in unix

e.g. iconv -f utf8 -t gbk filename.txt

        The above command will convert from utf8 format to gbk format of given file.

Categories: Technical, unix commands

Draw text in postscript

1000 1000 moveto (Your text here) show

Categories: PostScript, Technical

Drawing a line in postscript


100 100 moveto

1000 1000 lineto


Categories: PostScript, Technical

unix for Beginner

unix commands :

I have been working in unix for more than 2 years. So i thought of sharing my knowledge…….

Tip : Before searching about any command of unix in internet, see “man your_command”

           and remember unix is case sensitive

Simple and basic commands :

ls command :

             ls  – to list directories and files in your current working directory(pwd)

             ls “path” – to list directories and files in the given path

            e.g. ls “/var/tmp”  — this will list the directories and files in /var/tmp folder

cat command:

               cat comand – is used to view the contents of a file

               e.g. cat “fileame”

                        cat  /var/tmp/test  – will show the contents of “test” file which is in /var/tmp folder

more command:

                     more command is also used to view the content of a file but this command will give a pause in each page.

                      e.g more filename

cp command:

                  cp command is used to copy files.

                 e.g cp source destination

                   cp *.* /var/tmp/     – All the files with any extension will be  copied to /var/tmp/ folder.

                   cp -R *.* /var/tmp/ – All files and subdirectories will be copied to /var/tmp/  folder.

mv command:

                   mv command is used to move the files from one directory to another directory

                 e.g. mv source destination

                         mv *.* /var/tmp – all the files will be moved to /var/tmp/ folder.

                        mv -f source destination   -f means ,do not prompt for confirmation, just overwrite.

rm command:

                      rm command is used to delete a file in unix.

                       e.g. rm filename

                                rm *.* – delete all the files in current working directory

                                rm /var/tmp/*.* – delete all the files in /var/tmp/ folder

                                rm -f filename  -f means, do not prompt for confirmation, just delete.

mkdir command:

                 mkdir command is used to create a directory.

                  e.g. mkdir directory_name

                          mkdir test

cd command:

            cd  command is used to change directory.

            e.g  cd /var/tmp/test – changes the current directory to /var/tmp/test/

pwd command:

                     pwd command is used to see current working directory.

                     e.g pwd

                     output : /var/tmp/test/

wc command:

              wc command is used to count how many words/lines/chars/bytes

             e.g. cat file_name | wc -l – this will show how many lines in given file

                      cat file_name | wc -w – this will show how many words in given file.

date command:

                          date command is used to get the date and times .

                    e.g date – output will be “current date and time”

                        you can change date format:

                             e.g       date “+%y%m%d”

                      Get  yesterday’s date in unix

                                          date  “+%Y%m%d”  –date=”20100413 – 1 days”

                      Tomorrow’s date in unix

                                           date “+%Y%m%d”  –date=”20100413 + 1 days”

lpr command:

                       lpr command is used to print a file.

                     e.g. lpr -Pprintername filename

                    note: there should not be space between “P” and printer name

                  e.g. lpr -Pprintername -o”pgs=1″ filename

                  prints only the first page of file.

Categories: Technical, unix commands

Simple awk

To replace open “(” or close “)” in awk

 gsub(/\(/, “you string”,variable name);
 gsub(/\)/, “your string”,variablename);

To Replace single quote :

                                  gsub(/47/, “replacement string”, variable);

                 047- is the octal value of single quote

To Concatenate string:

variable3 = variable1 variable2;

To Split and put it in an array:


                   n— Number of elements or size of strarr

                  “,” — Delimiter

To Substring :

resultString = substr(“your string here”,starting position,Ending position);

Example :

                       resultString=substr(“your string here”,1,5);

Length of a variable:


Comments in awk:

                      #Whatever comes after this pound symbol will be comments in awk

For Loop :

                           for(i=1;i<n;i++)  {

                                            #your statements here


While Loop:

                        while(your condition)


                                           # your statements here


if Condition :

              Simple if = if(your condition) { }

             Simple  if else  = if(your condition) {} else {}

                else if = if(your condition) {} else if(your alternative condition) else {}

                Operaters for if conditions :   == (equal to) , &&(And) , || (OR) , !(Not) , <= (less than or equal) , >=(Greater than or equal) , <(less than), >(Greater than)

Passing parameter to AWK:

                  awk -F” ” -vYour_Param=”Value) {}

                -F  — Field Separator

               -v—-Using this option you can send your parameter to awk

Categories: Technical

Draw Circle in postscript

1451 2340 8 0 360 arc closepath
0 0 0 setrgbcolor fill % filling black color

Categories: PostScript, Technical