I want to create a shell script that will have 4 variables passed in one is a dir and the other is a time less 1 , 2 hours a string to search for and either print to the screen or write to a file.
Script name :check_log_files.ksh
Var1 directory: suppliers
Var2 time - 1: -1 -2 -10 etc
Var3 grep: ORA-
Var4 write or print: print
./check_log_files.ksh suppliers -2 ORA- print
This would check the log files in /code/conversion/$1/log for the word ORA- that were generated in the last two hours and print the file name and line with ORA- in it.
./check_log_files.ksh suppliers -2 ORA- write
This would do the same as above except write the output to a file. The file name would be
Only file of type .log and .lst are checked.
Thanks in advance.