Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

awk delete lines

Posted on 2013-12-22
2
Medium Priority
?
517 Views
Last Modified: 2013-12-22
how should i delete lines older then 5 minute from a file which has lines as below


   2013-12-22 22:40:44.413        37.123.97.70    95.88.68.72     14109   49304   385     0x18    6       256
         2013-12-22 22:40:44.414        37.123.99.218   88.252.179.218  31701   4621    68      0x10    6       256
         2013-12-22 22:40:44.414        178.20.231.102  78.183.53.41    80      53905   1514    0x10    6       256
         2013-12-22 22:40:44.415        185.9.159.17    139.27.241.27   4980    445     70      0x02    6       256
         2013-12-22 22:40:44.415        178.20.225.205  173.245.53.168  80      58023   82      0x12    6       256
         2013-12-22 22:40:44.415        178.20.230.21   78.166.207.202  7777    55093   103     0x12    17      256
         2013-12-22 22:40:44.416        178.20.231.102  94.123.206.219  80      15558   1462    0x10    6       256
         2013-12-22 22:40:44.560        178.20.231.102  78.183.53.41    80      53916   1514    0x10    6       256
         2013-12-22 22:40:44.561        185.9.159.61    50.23.124.46    2794    3389    68      0x14    6       256
         2013-12-22 22:40:44.561        178.20.230.190  60.173.11.197   80      52219   1522    0x10    6       256
         2013-12-22 22:40:44.562        185.9.159.61    50.23.172.118   2779    3389    68      0x04    6       256
         2013-12-22 22:40:44.562        185.9.156.136   88.170.121.30   7102    57235   1428    0x18    6       256
         2013-12-22 22:40:44.562        178.20.230.198  88.244.251.111  27015   27005   125     0x18    17      256
         2013-12-22 22:40:44.562        178.20.227.86   173.194.70.116  3396    443     91      0x18    6       256
         2013-12-22 22:40:44.683        178.20.228.120  94.121.72.60    28281   56120   122     0x18    6       256
         2013-12-22 22:40:44.684        178.20.230.198  95.15.92.219    27015   27005   147     0x18    17      256
         2013-12-22 22:40:44.684        178.20.225.204  141.101.98.94   80      15427   74      0x10    6       256
         2013-12-22 22:40:44.684        178.20.230.21   88.246.211.15   7777    15911   330     0x10    17      256
         2013-12-22 22:40:44.685        185.9.159.61    50.23.150.170   4022    3389    349     0x18    6       256
         2013-12-22 22:40:44.705        178.20.227.71   71.122.225.92   4022    3389    1522    0x18    17      256
         2013-12-22 22:40:44.705        185.9.159.218   193.140.225.132 80      31266   1522    0x10    6       256
         2013-12-22 22:40:44.754        178.20.231.4    78.177.107.74   80      22942   1462    0x10    6       256
         2013-12-22 22:40:44.755        185.9.159.160   164.29.48.61    3708    445     70      0x02    6       256
         2013-12-22 22:40:44.755        37.123.100.41   188.3.4.237     13200   1830    182     0x18    6       256
         2013-12-22 22:40:44.756        185.9.156.136   88.231.184.107  9999    1296    68      0x10    6       256
         2013-12-22 22:40:44.756        185.9.159.158   78.177.74.180   27015   27005   89      0x10    17      256
         2013-12-22 22:40:44.756        185.9.159.61    50.23.196.186   3044    3389    68      0x10    6       256
         2013-12-22 22:40:44.756        185.9.159.70    62.165.213.180  10334   33982   76      0x10    17      256
         2013-12-22 22:40:44.757        178.20.231.92   195.175.39.91   53      43945   96      0x10    17      256
         2013-12-22 22:40:44.861        37.123.99.213   62.210.129.52   2576    80      68      0x10    6       256
         2013-12-22 22:40:44.861        37.123.99.196   88.232.195.163  31691   55976   110     0x18    6       256
         2013-12-22 22:40:44.862        185.9.159.61    50.23.38.98     4675    3389    93      0x18    6       256
         2013-12-22 22:40:44.863        178.20.227.71   199.223.219.71  4675    3389    1522    0x18    17      256
         2013-12-22 22:40:44.863        185.9.159.61    50.23.184.102   3363    3389    68      0x10    6       256
         2013-12-22 22:40:44.864        185.9.159.61    50.23.33.215    3842    3389    68      0x10    6       256
         2013-12-22 22:40:44.864        178.20.230.180  78.179.132.228  9998    49465   1514    0x10    6       256
         2013-12-22 22:40:44.865        178.20.226.121  176.227.204.58  52919   80      74      0x10    6       256
         2013-12-22 22:40:45.053        185.9.159.61    50.23.113.165   3927    3389    115     0x18    6       256
         2013-12-22 22:40:45.053        178.20.231.82   78.168.36.236   80      63232   1474    0x10    6       256
         2013-12-22 22:40:45.053        178.20.231.95   217.79.181.38   80      56874   1522    0x10    6       256
         2013-12-22 22:40:45.054        185.9.159.61    50.20.217.230   1192    3389    449     0x18    6       256
         2013-12-22 22:40:45.054        185.9.159.61    50.23.196.26    4276    3389    68      0x10    6       256
         2013-12-22 22:40:45.055        178.20.225.197  141.101.92.234  80      50112   1522    0x10    6       256

Open in new window

0
Comment
Question by:3XLcom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 39735055
perl -MPOSIX -i.bak -ane 'BEGIN{$d=strftime"%Y-%m-%d %H:%M:%S",localtime time-300}print if "@F[0,1]" ge $d'  file
0
 

Author Closing Comment

by:3XLcom
ID: 39735075
thank you
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question