Encountered a problem when querying the log found that there are many files printed on the server, each of which stores a portion of the log, the log needs to be sorted by time and all logs are displayed.
Original command:
grep-h searchcontent */*log
The search results will show all the contents in the following format:
File1.log: time ....
File2.log: time ....
Because the log after the file name also contains :, so the use of separators : The method of separating sorting is not feasible, at this time, you need to not include the file name in grep, after searching for a pass, find a parameter "-H", Can not display file name
grep-h searchcontent */*log
Now the log shows that it meets the requirements, and the sorting can be done to sort the display log by time
grep-h searchcontent */*log | sort
Refer to the connection and keep learning:
Http://www.cnblogs.com/dmcpxy/archive/2012/02/28/grep-normal-usage.html
Https://www.cnblogs.com/51linux/archive/2012/05/23/2515299.html
http://blog.csdn.net/teamlet/article/details/38046409/
"Linux" Log analysis tool grep sed sort