I am using sed command to extract data from my log file for a certain time interval. From and To "time" are my input arguments.
Now if i use the sed command on command line. I get the desired results and If i use it in script.It fails.
sed command as command line:
sed -n '/04-Mar-2015 12:51:08/,/04-Mar-2015 12:51:52/p' test.log | grep 'fail' >new.log
This one works fine.
In script , I am using
sed -n '/$FromTime/,/$ToTime/p' $logFile > new_log.log
and as I input time while running script, I get below error
user@host> sh log.sh test.log 04-Mar-2015 12:51:08 04-Mar-2015 12:51:52
sed: 0602-419 Cannot find or open file 04-Mar-2015.
Can anyone help me what am i missing in script??I am new to scripting.Any help would be highly appreciated.