I have a file a.txt which contains the date and time.
22/Aug/2010:02:03:00
21/Aug/2010:00:00:00
21/Aug/2010:00:02:00
22/Aug/2010:00:00:00
22/Aug/2010:01:00:00
22/Aug/2010:02:00:01
22/Aug/2010:03:00:00
How to get the lines greater than or equal to 21\/Aug\/2010:06:00:00 and less than or equal 22\/Aug\/2010:09:00:00.
sort -k1 a.txt | sed -n "/\[21\/Aug\/2010:06:00:00/,/\[22\/Aug\/2010:09:00:00/p" > b.txt
67.162.10.216 - - [21/Aug/2010:00:00:00 +0000] GET /2010-08-18/news/ct-met-barrington-student-death-20100818_1_mental-illness-suicide-prevention-teen-suicides HTTP/1.1 200 6826
67.162.10.216 - - [22/Aug/2010:01:00:00 +0000] GET /tracker.js.php?45aa01ed37b58d2a537b1ba12bb97fe2e5695a8c HTTP/1.1 200 2915
67.162.10.216 - - [22/Aug/2010:02:00:00 +0000] GET /tracker.js.php?45aa01ed37b58d2a537b1ba12bb97fe2e5695a8c HTTP/1.1 200 2882
66.249.71.98 - - [22/Aug/2010:00:04:00 +0000] GET /ad-openx.php?out=js&d=mod-top-hdr-defer&z-i=24809&z-n=top-leaderboard&i-w=728&i-h=90&i-e=pi%3D45%26amp%3Btv%3Dkp-CT1-G%26amp%3Bpm_mode%3Dp&i-s=pgtp%3Dkeyword%26pi%3D45%26pe_id%3Dcarrot-cake%26tn%3Dnone%26tv%3Dkp-CT1-G HTTP/1.1 200 1020
how to sort the file based on timestamp, How to get the lines greater than or equal to 21\/Aug\/2010:06:00:00 and less than or equal 22\/Aug\/2010:09:00:00
sort -k4 a.txt | sed -n "/\[21\/Aug\/2010:06:00:00/,/\[22\/Aug\/2010:09:00:00/p" > b.txt
I have a tab delimited file(as mentioned above),which contains the timestamps entries for 2 days,(Aug 21st and Aug 22nd) in which 4th column is the timestamps.
I have to sort the file based on timestamps and extract the lines which is
greater than or equal to 21\/Aug\/2010:06:00:00 and less than or equal 22\/Aug\/2010:09:00:00