Friday, April 1, 2016

Linux Bash Shell Script Time Interval Regex with Piped Loop to Print Log Data


How the code below works:

The code below by getting all the lines within the log.txt with matching times. Next it reads the data line by line in three separate variables and prints the data.

Input File:

Save the input in file named "log.txt".

Code To Match Time Interval:

Save the code in a file named "TimeIntervalRegex.sh".

Running the Code:

Just type the code below in terminal. Make sure to cd into that directory if you have not opened the terminal in that directory.

bash TimeIntervalRegex.sh

No comments: