My script is not grabbing information from a text file from a certain date correctly. It seems to be grabbing everying in the file, i know it is something simple but i have looked to hard and to long, to know what the issue is.
Set owner nbkpmstr to CBLJMM - Should not be shown, yesterday file input!!
Set owner nbkpmstr to CBL288
Set owner nbkpmstr to CBL011
Set owner nbkpmstr to CBL225
Set owner nbkpmstr to CBL132
File Read - /tmp/test
$ cat /tmp/test
04/12/12 15:10:25
volume: CBLJMM
Remove prior owner SYSTEM from CBLJMM
Set owner nbkpmstr to CBLJMM
04/13/12 15:10:14
volume: CBL288
Remove prior owner SYSTEM from CBL288
Set owner nbkpmstr to CBL288
04/13/12 15:10:25
volume: CBL011
Remove prior owner SYSTEM from CBL011
Set owner nbkpmstr to CBL011
04/13/12 15:10:36
volume: CBL225
Remove prior owner SYSTEM from CBL225
Set owner nbkpmstr to CBL225
04/13/12 15:10:37
volume: CBL132
Remove prior owner SYSTEM from CBL132
Set owner nbkpmstr to CBL132
We should only see out for the currernt date i.e 04/13/2012
Set owner nbkpmstr to CBL288
Set owner nbkpmstr to CBL011
Set owner nbkpmstr to CBL225
Set owner nbkpmstr to CBL132
The script should read the file below looking for the current date and grab only "Set owner ". So from the example below is should grab CBL288 and not CBLJMM..
File Read - /tmp/test
$ cat /tmp/test
04/12/12 15:10:25
volume: CBLJMM
Remove prior owner SYSTEM from CBLJMM
Set owner nbkpmstr to CBLJMM
04/13/12 15:10:14
volume: CBL288
Remove prior owner SYSTEM from CBL288
Set owner nbkpmstr to CBL288
The code I suggested should work provided the input format of your file does not change!!!
Tested in my system as below:
SCRIPTS>cat input_file
04/12/12 15:10:25
volume: CBLJMM
Remove prior owner SYSTEM from CBLJMM
Set owner nbkpmstr to CBLJMM
04/13/12 15:10:14
volume: CBL288
Remove prior owner SYSTEM from CBL288
Set owner nbkpmstr to CBL288
04/13/12 15:10:25
volume: CBL011
Remove prior owner SYSTEM from CBL011
Set owner nbkpmstr to CBL011
04/13/12 15:10:36
volume: CBL225
Remove prior owner SYSTEM from CBL225
Set owner nbkpmstr to CBL225
04/13/12 15:10:37
volume: CBL132
Remove prior owner SYSTEM from CBL132
Set owner nbkpmstr to CBL132
SCRIPTS>xargs -l4 < input_file | grep `date "+%m/%d/%y"` | sed 's/.*Set/Set/'
Set owner nbkpmstr to CBL288
Set owner nbkpmstr to CBL011
Set owner nbkpmstr to CBL225
Set owner nbkpmstr to CBL132