1. Basic log viewer command
tail change -400f demo.log # 400 last lines of the log file monitoring equivalent tail -n 400 -f (- f parameters in real time) less demo.log # view the log files, support for up and down scrolling, search function uniq -c Demo. log # marks the line number of repeats, the value 1 will not be repeated
2. grep command is simple to use
Rules: grep [options] pattern ... [file] ... (pattern is a regular expression)
grep ' ERR ' appcrawler.log # ERR for any lines contained in the document appcrawler.log
grep -C 'ERROR' appcrawler.log # output file appcrawler .log find the number of lines in all the rows of ERROR packet
grep -v 'ERROR ' appcrawler .log # find free "ERROR" row
grep -o ' Order-fix.curr_id: \ ([0-9] \ + \) ' demo.log # -o option to extract only the order-fix.curr_id: xxx Content (rather than a whole line), and outputs to the screen
3. streamline the contents of the log sed
To extract the contents of the log file by replacing the command sed