Using findstr /R to look for dates in csv files. RRS feed

  • General discussion

  • Hello,

    I have an applications that is failing due to constant date formatting issues so I am trying to pin point all the files with the differing date formats. Currently it is working when dates come in DD-MMM-YY (01-Jan-19) however when my dates are in DD/MM/YY (01/01/19) the applications falls over (it is probably a bug in the application but I have no control over that). The data files have some extra header information and some data that is being loaded underneath the headers, the date is always positioned in Column A Cell 5.

    I am a bit of a rookie with the findstr commands and regular expressions but I have managed to piece this together:

    findstr /R /M "^(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d$" C:\Temp\*.csv > C:\Temp\test.txt

    The end goal would be to have the file name and potentially the value that is causing the issue printed into a separate text file.

    Any help would be greatly appreciated. 

    • Changed type Bill_Stewart Tuesday, April 14, 2020 4:41 PM
    • Moved by Bill_Stewart Tuesday, April 14, 2020 4:41 PM Unanswerable drive-by question
    Friday, December 6, 2019 3:44 PM

All replies

  • What date formatting issues? What data files? What headers? What does the data look like? (Remember, we can't see your screen.)

    Aside from this, you're much, much better off using PowerShell.

    -- Bill Stewart [Bill_Stewart]

    Friday, December 6, 2019 4:11 PM