Parsing lines of text file based on date

I am trying to parse a text file which contains a dump of “rpm -qa -last” to filter updates applied within the last year on a RHEL server. My query works in the debugger for the first 3 lines and then says 'Singular expresion refers to nonexistant object"

My relevance is as follows:

((month of it as two digits & "/" & day_of_month of it as two digits & "/" & year of it as string) of (((date (local time zone) of it) whose(it > date (local time zone) of now - 365*day)) of (((preceding text of first "," of it) as integer * second) + ("01 Jan 1970 00:00:00" as local time))), (following text of first "," of it) ) of (lines of file "c:\temp\rpmqa")

and the rpm qa file contains:

1453332607,keyutils-libs-1.4-5.el6.x86_64
1453332607,keyutils-1.4-5.el6.x86_64
1453332606,libgssglue-0.1-11.el6.x86_64
1428272368,hpsmh-7.3.2-1.x86_64
1439272363,CAeAC-1262-2.0.633.x86_64
1437047574,ca-lic-01.90.04-00.x86_64
1419507496,clamav-db-0.97.6-1.el6.rf.x86_64
1419507496,clamav-0.97.6-1.el6.rf.x86_64
1419507491,libtool-ltdl-2.2.6-15.5.el6.x86_64
1419440168,telnet-0.17-48.el6.x86_64
1419440127,BESAgent-9.1.1117.0-rhe5.x86_64

The fourth line of the file is when the unix time changes to 2015. The first three lines are from 2016.

Any help to get this sorted out, or if there is a better way would be appreciated.

More importantly, the fourth line is from more than 365 days ago, and you filter with whose (it > date (local time zone) of now - 365 * day) , which filters it out returning “nothing” that messes up the rest of it.

I think this will get what you want (replace the string set with your “lines of file” :

q: (preceding text of first "," of it as integer * second + "01 Jan 1970 00:00:00" as local time, following text of first "," of it) whose (now - item 0 of it < 365 * day) of ("1453332607,keyutils-libs-1.4-5.el6.x86_64";"1453332607,keyutils-1.4-5.el6.x86_64";"1453332606,libgssglue-0.1-11.el6.x86_64";"1428272368,hpsmh-7.3.2-1.x86_64";"1439272363,CAeAC-1262-2.0.633.x86_64";"1437047574,ca-lic-01.90.04-00.x86_64";"1419507496,clamav-db-0.97.6-1.el6.rf.x86_64";"1419507496,clamav-0.97.6-1.el6.rf.x86_64";"1419507491,libtool-ltdl-2.2.6-15.5.el6.x86_64")
A: ( Wed, 20 Jan 2016 23:30:07 -0500 ), keyutils-libs-1.4-5.el6.x86_64
A: ( Wed, 20 Jan 2016 23:30:07 -0500 ), keyutils-1.4-5.el6.x86_64
A: ( Wed, 20 Jan 2016 23:30:06 -0500 ), libgssglue-0.1-11.el6.x86_64
A: ( Tue, 11 Aug 2015 05:52:43 -0500 ), CAeAC-1262-2.0.633.x86_64
A: ( Thu, 16 Jul 2015 11:52:54 -0500 ), ca-lic-01.90.04-00.x86_64
T: 0.169 ms
I: plural ( time, substring )

Jason, thanks for the reply. I fed my entire file and like mine, yours seems to work until it gets to a value that doesn’t match the filter and results in an error at the end.

I ended up tweaking and simplifying the date format that is produced in the file to be:

20 Jan 2016 : rpcbind-0.2.0-11.el6_7.x86_64
20 Jan 2016 : nfs-utils-lib-1.1.5-11.el6.x86_64
20 Jan 2016 : nfs-utils-1.2.3-64.el6.x86_64
20 Jan 2016 : libtirpc-0.2.1-10.el6.x86_64

and modified my relevance as follows:

(((preceding texts of firsts " : " of it) whose(current date - it as date < 365*day)), (following texts of firsts " : " of it)) of lines of file…

This works as expected.