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;