I need to search for a pattern in files.
For example the content of the file is below:
3555005!K!00630000078!C!20090805235959!47001231000000!16042296!336344324!A!1!ENG!0!00630000078!NO!00630000078!
3555005!K!204042880166840!I!20090805235959!47001231000000!16042296!336344324!A!1!ENG!0!00630000078!NO!00630000078!
3555005!D!16042296!DUMMY!20090805235959!0!47001231000000!0!336344324!1!1!POST!USAGE!336344324!0!
3555005!C!336344324!1!!!EUR!1!1!!I!
3555005!S!00630000078!20090805172515!LF010300!
Here I want to search for lines with !D! and the 7th field in the line is less than the system date, then I want to delete the line and save the file.
Is that possible?
If you prefer AWK…
where logstrip.awk looks something like
should do the trick.
Attention, however, your field #7 contains an odd date format. I think I recognize an recent epoch value (123…) but it is preceded by 4 apparently unrelated digit. These can easily be removed before comparing to StopDate