I'm working on a script to find missing Kafka topics in a folder. I'm quite far already, but I just need one more step to make it perfect. The script searches through multiple folders and files and returns below result.
2022 Mar 11 ADR00180 - Is missing the topic for: xx
2022 Jul 17 ADR00195 - Is missing the topic for: xx
2022 Feb 16 ESO00011 - Is missing the topic for: xx
2022 Aug 09 EMF00023 - Is missing the topic for: xx
2022 May 24 ESO00012 - Is missing the topic for: xx
2022 May 22 ESO00013 - Is missing the topic for: xx
Now I'm trying to convert the date in the string to a 'real' date and remove the lines older than one week. I am though unsure where to start.
CodePudding user response:
You could filter it through this (g)awk script:
BEGIN {
lastweek = systime() - 60*60*24*7;
}
{
"date %s -d \""$1" "$3" "$2"\"" | getline linedate;
if (linedate > lastweek)
print;
}