Cannot search for date in line of file

Hey guys, sorry if this is an easy one, but we have done this for file names a bunch and I cannot seem to get this working when searching for a line in a file. basically, I have a file that is the result of a dir command. This file is recreated every morning. The filenames in the file contain the date YYYYMMDD and also a string I need to look for, “POP”. I am trying to pull the lines from the file that contain POP and also have the previous date in it. I have tried a ton of things, but cannot get there. here is what I have now, any help would be appreciated.

lines whose (it contains "POP" and (((current year as string & current month as two digits & current day_of_month as string)) of date (local time zone) of (now-1*day))) of file "c:\temp\POPstagingdir.txt"

I know that the below works

 q: ((month of it as two digits & day_of_month of it as two digits) of date (local time zone) of it) of (now -1*day)
A: 0111
T: 0.096 ms

q: Lines whose (it contains "POP") of file "c:\temp\POPstagingdir.txt"
A: 01/11/2016  06:20 PM            34,352 POP_20160111_182024.DAT
A: 01/11/2016  06:07 PM            78,287 POP_20160111_180706.dat

This is your problem:

This is not a boolean result.

It needs to be:

it contains "POP" AND it contains MMDD
1 Like

I would try this… lines whose (it contains "POP" and it contains (((month of it as two digits as string & "/" & day_of_month of it as string & "/" & year of it as string)) of date (local time zone) of (now-1*day) as string) of date (local time zone) of (now-1*day)) of file "c:\temp\POPstagingdir.txt"

1 Like

thank you for the info

This works just fine, thanks man. I was close, but couldn’t get there :frowning: Thanks again man

1 Like

it gets addictive. :slight_smile: