Archive

Archive for July, 2010

Split function in awk

Syntax:
======
     count = split(string,array,delimiter);
Example
======
     splittext=”This is a sentence”

     count_items = split(splittext,splitarray, ” “);

output:
=====

     splitarray[1]=”This”
     splitarray[2]=”is”
     splitarray[3]=”a”
     splitarray[4]=”sentence”

Loop thru the result:
===============

     for(i=1;i<count_items;i++)
     {
           print splitarray[i]
     }

Advertisements
Categories: awk, Technical

wget post method

To convert a GET Method to POST method for wget command in unix
Have one of the following params in http call:
    –post-file=”filename”
    –post-data=”your_parameters”

Categories: Technical, unix commands

Copy folder in unix

syntax:
======
cp -r “sourcepath/folder” “dest_path/folder”

Example:
======
     cp -r “/home/karuvatchi/photos/” “/home/backup/photos/”

if the folder is in current directory:
     cp -r photos /home/backup/photos/

Categories: Technical, unix commands

Case in select statement of pl/sql

Syntax:
=======
      select case “column_name”
          When ‘condition’ then ‘result’
          When ‘condition1’ then ‘result1’
          When ‘condition2’ then ‘result2’
          ELSE ‘result3’ — For Default
          END,column_name1,column_name2
     From
        table_name

Example:
=======
      select case status
          When 1 then ‘Pending’
          When 2 then ‘Sumitted’
          When 3 then ‘Confirmed’
          ELSE ‘Invalid’
          END,emp_name,emp_no
     From
        employee;

Categories: SQL, Technical

Delete files created one day before in unix

Solution:
======
find . -name “*.txt” -type f -mtime +1 -exec rm -f {} \;

Description:
========
       In the current directory(. dot) look for the files with “txt” extension and created one day before,delete those files.

Categories: Technical, unix commands

Delete files created 30 mins before in unix

Solution:
======
find . -name “*.txt” -type f -amin +30 -exec rm -f {} \;

Description:
========
       In the current directory(. dot) look for the files with “txt” extension and created half an hour before,delete those files.

Categories: Technical, unix commands

How to Change Text box fore/background/border color in Jabascript

text1.style.color=’red’ // foreground color
text1.style.backgroundColor=’green’ // background color
test1.style.border=’blue’ // border color

Categories: JavaScript, Technical