Arun Manivannan
BAN USERSpot on man. The solution is just a glorified binary search. And the max number of iterations (levels) can always be limited to
log base 2 n
+ 1
- Arun Manivannan August 31, 2012:-) Feeling is mutual dude.
- Arun Manivannan August 30, 2012I am sorry. Is this solution supposed to be for this question?
- Arun Manivannan August 30, 2012Unfortunately, overriding hashcode wont help. The default implementation of Object just checks for reference equality and does not consider hashcode while calling the "equals" method. That said, frankly, I am unable to figure out the answer myself.
- Arun Manivannan August 30, 2012You could do a
tail -f <LOG FILE NAME> | grep "^ERROR"
but then this wouldn't handle log file roll over.
- Arun Manivannan August 29, 2012Oh sorry about that. Since the question didn't have any references to implementation, I thought the usage of a tool is acceptable.
Like you said, we could use brute force. Just that instead of checking for \n, we could stop soon after we reach the character length of search string or 5 in case of "ERROR"
Duplicate of the other question that you posted. At the risk of being redundant, here is the possible answer
I am sure you can achieve this by using sed or awk in a more elegant way but here are the other ways
grep "^ERROR" <YOUR LOG FILE NAME"
cut -d " " -f1 <YOUR LOG FILE NAME> | grep "ERROR"
The "cut" command assumes that your log file delimiter is a space.
I am sure you can achieve this by using sed or awk in a more elegant way but here are the other ways
grep "^ERROR" <YOUR LOG FILE NAME"
cut -d " " -f1 <YOUR LOG FILE NAME> | grep "ERROR"
The "cut" command assumes that your log file delimiter is a space.
ROFL. Wish there were a "super like" button in career cup
- Arun Manivannan August 31, 2012