![]() "a2ensite" is another string on the same line that you expect to find the "INFO" string on. "INFO" is one of the strings that is in the lines of logs that you're interested in. _19:12:00,_21:13:00 is the range of date from within the log that you wish to scan ![]() tmp/client.log is of course the log file. In this particular case, it is telling the tool what type of log file /tmp/client.log is. Notchef is an option that is passed to the tool to tell it what to do. There's actually a much easier way to do this.Ĭommand. The -F option splits every line into separate fields according to the regex (matching either : or a space), and the awk script checks the 2nd column (the hour). It will match all numbers from 08 to 22.Ī somewhat better option is: awk -F'' '$2 >= 8 & $2 <= 22 ' (.|.|.) means "either of the given patterns", so (0|1|2) means "either 0 or 1 or 2". So ^+ will start with the beginning of line, and match as many non-space characters as it can. + means "one or more of the previous" (for example, a+ would match a, aaa, and aaaaaaaa). means "any character between the brackets", so will match either 8 or 9 is any number, and is anything except a space (because of the ^ inside brackets). + just matches the date field, regardless of the actual date. Detailed explanation can be found in various regex (regular expression) tutorials egrep uses "POSIX extended" syntax ( man 7 regex).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |