Hi,
I am trying to grep a particular string from the files of 2 different servers without copying and calculate the total count of its occurence on both files.
File structure is same on both servers and for reference as follows:
---------- Post updated at 03:11 PM ---------- Previous update was at 03:09 PM ----------
Please consider this example for grep string from logs of last 15 minutes too.
---------- Post updated at 03:41 PM ---------- Previous update was at 03:11 PM ----------
Find the code below which i have made but getting error.
The code checks the last 15 minutes logs and search the string and get the total count.Can anybody correct the following code or provide me the optimized way:
add these lines to the top of the script(but after the first line) and then post the entire output. the command your running remotely is kind of complex to troubleshoot because of the variables and quoting. can you put the logic in a script on the remote side and then just execute the script?
set -x
set -u
another suggestion - use
grep -c
instead of
|wc -l
you could easily remove the grep and place use the logic in awk to streamline even further.