Bash, , . , Ruby, , . Unix ( , ).
irb> require 'time'
# => true
irb> Time.parse("May 3 13:21:12").to_i
# => 1241371272
Ruby script:
. Unix , .
" ". "", , . , , , , , ( , ), , . , .
. :
If you are really concerned about finding the start and end records efficiently, you can do a binary search for everyone. Or, if it seems redundant or too complicated with Bash tools, you can get a heuristic for reading only 5% of the lines (1 out of every 20) to quickly find the exact answer and then clarify what you want. These are just some suggestions for improving performance.
source
share