linux - How can I detect a date from the content of a file using %F bash shell -


i have files have date inside , want check if content of file more current. can check comparison of dates cannot grep date file. example in file1 have:

my name adelaide in lagos 9:29am (author)}||2015-03-13 13:12:59.239308|2012-07-09 10:00:00|reading|3110311|off internet |3012364|3012364|3012364|63613191| sectionstart  

file2 has:

63615595| summary|final|new roman; name if here  earsprovider: ||2015-03-13 13:12:59.239308| summary 2012-07-09 09:00:00|2210299|3110311|2824032|o6550610|63615595| 

since not in conformity of table , file can have more 1 date format in it, want retrieve dates yyyy-mm-dd hh:mm:ss format.

try gnu grep timestamps:

grep -op '[0-9]{4}-[0-9]{2}-[0-9]{2} [0-2][0-9]:[0-5][0-9]:[0-5][0-9](?=\|)' file 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -