unix

Search records and null

Find in a table, for any field of the table, how many records are NULL, and of these NULL how many separate by values of another field of the same table. Example result: TAB_NAME                      COL_NAME                      NUM_ROWS                   NUM_NULLS_TOT       NUM_NULLS_X_COLVAL               COLVAL_LE_ID ————————————————————————————- S_REPORT                        S_TAX_BRACKET_CD                        7111600   7111599   2470            631 S_REPORT                        S_TAX_BRACKET_CD                        7111600   7111599   57859         FC222200 S_REPORT                        S_TAX_BRACKET_CD                        7111600   7111599   3038882   Z2030 S_REPORT                        S_TAX_BRACKET_CD                        7111600   7111599   4012388   C8101   The S_REPORT table has 7111600 rows and has a column name S_TAX_BRACKET_CD that has 7111599 NULL rows. The S_REPORT table also has a column name LE_ID which its value are 631, FC222200, Z2030 e C8101. Read More

File Directory Change Monitoring

1) Purpose: We want to check out a unix directory, signaling with an email if its content change.   2) Solution: Before modify appropriately the configuration parameters inside, then run in background mode (sh filedirChangeMonitoring.sh &) the following shell script.   #!/bin/bash # #  filedirChangeMonitoring.sh #  DATE : 2014-07-30 #  DESC.: #  Script for the monitoring of files in a directory #  The script checks if changes are made to the files of a directory and it alerts with an e-mail #  Before running the script modify the following parameters: TO_ADDRESS, FROM_EMAIL_ADDRESS, xDirMon and xTime #  PARENT SCRIPT: none # Read More