Is Perl faster than bash?

前端 未结 10 1928
刺人心
刺人心 2020-12-15 09:26

I have a bash script that cuts out a section of a logfile between 2 timestamps, but because of the size of the files, it takes quite a while to run.

If I were to rew

10条回答
  •  时光说笑
    2020-12-15 09:53

    In your bash script, put this:

    perl -ne "print if /$FROM/../$TO/" $LOGFILES
    

    $FROM and $TO are really regex to your start and end time.

    They are inclusive, so you might want to put 2009-06-14 23:59:59 for your end time, since 2009-06-15 00:00:00 will include transactions at midnight.

提交回复
热议问题