perl awk OR sed, search between two timestamps

后端 未结 5 1527
死守一世寂寞
死守一世寂寞 2021-01-24 20:50

I have a file with following sample text. (The actual text is huge).

2014/05/08-19:15:44.544824-
2014/05/08-19:21:54.544824-
2014/0         


        
5条回答
  •  萌比男神i
    2021-01-24 21:18

    Using a perl one-liner. Capture the time and then just compare.

    perl -ne '$t = /(\d+:[\d:.]+)/ ? $1 : undef; 
        print if $t ge "19:15:00" && $t le "19:20:00";' file.txt
    

提交回复
热议问题