Thursday, July 26, 2007

Unix Commands

Command option to print line number with grep

grep -n pattern filename

With the line number use tail + file | more to see the content of the file from that line onwards.

Command option to print the number of occurences

grep -c pattern filename

or

grep pattern filename | wc -l

To see the last occurrences

tail -1000 filename | grep pattern

Tuesday, July 24, 2007

DB2 Syntax

To specify date in where clause for db2, use this format.
'2007-07-24-12.19.47'

To Print Date in mm/dd/yyyy format use

select char(date(current_timestamp),USA) from sysibm.sysdummy1;

Thursday, July 05, 2007

Unix Commands

  1. To see the disk usage use df -ks .
  2. To see the disk usage in gb use df -gs .
  3. To see which ports are in use or see available ports use these commands
    netstat -an find /i "listening"