1
log file is like this
34.3.23.58 07:20:01 AM all 0.02 0.00 0.02 0.00 0.00 99.97
34.3.23.58 07:30:01 AM all 0.02 0.00 0.02 0.00 0.00 99.97
34.3.23.58 07:40:01 AM all 0.02 0.00 0.02 0.00 0.00 99.97
34.3.23.58 Average: all 0.02 0.00 0.02 0.00 0.00 99.96
34.3.23.60 Linux 3.10.0-514.26.2.el7.x86_64 (dns) 09/25/2019 _x86_64_ (4 CPU)
we want to capture only the lines when second field is hour:min:sec
as the following expected results
cat info.txt
34.3.23.58 07:20:01 AM all 0.02 0.00 0.02 0.00 0.00 99.97
34.3.23.58 07:30:01 AM all 0.02 0.00 0.02 0.00 0.00 99.97
34.3.23.58 07:40:01 AM all 0.02 0.00 0.02 0.00 0.00 99.97
we try
cat info.txt | awk '$2 =~ [0-9][0-9]/:[0-9][0-9]:[0-9][0-9]'
but run with errors
awk: cmd. line:1: $2 =~ [0-9][0-9]/:[0-9][0-9]:[0-9][0-9]
awk: cmd. line:1: ^ syntax error
awk: cmd. line:1: $2 =~ [0-9][0-9]/:[0-9][0-9]:[0-9][0-9]
awk: cmd. line:1: ^ syntax error
awk: cmd. line:1: $2 =~ [0-9][0-9]/:[0-9][0-9]:[0-9][0-9]
awk: cmd. line:1: ^ syntax error
awk: cmd. line:1: $2 =~ [0-9][0-9]/:[0-9][0-9]:[0-9][0-9]
awk: cmd. line:1: ^ unterminated regexp
What errors? More detail will let people help you quicker – Randomhero – 2019-09-25T09:45:34.730
see please my update – King David – 2019-09-25T09:50:53.697