perl awk OR sed, search between two timestamps

后端 未结 5 960
北荒
北荒 2021-01-24 20:44

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条回答
  •  盖世英雄少女心
    2021-01-24 21:10

    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
    

提交回复
热议问题