I have a file like this:
2014-12-31 531.252429 532.602384 525.802363 526.402397 1368200 526.402397
2014-12-30 528.092396 531.152424 527.132366 530.422394 876300 530.422394
2014-12-29 532.192446 535.482414 530.013375 530.332426 2278500 530.332426
2014-12-26 528.772422 534.252417 527.312364 534.032454 1036000 534.032454
2014-12-24 530.512424 531.761394 527.022384 528.772422 705900 528.772422
2014-12-23 527.00237 534.56241 526.292354 530.592416 2197600 530.592416
and want to echo each line between 2014-12-31 and 2014-12-23 in a bash script.
I tried this before, but it ended up showing me the lines I wanted but in a never-ending loop.
perl -ne 'if ( m/^([0-9-]+)/ ) { $date = $1; print if ( $date ge "2014-12-31" and $date le "2014-12-23" ) }' file.txt
What went wrong and how can I fix the code?