I have a big pile of pdf's and I would like to batch rename them by content. (They are all searchable). And I'd like to do so using command line interface.
They are all payslips so they have a constant form, and I'd like to rename by date.
Currently they are named: payslip100 .. payslip308
The string for renaming would be the date component in
Payment Date: 15/4/2016
I have installed pdfgrep using home-brew and am searching using
pdfgrep -HC 15 "Payment Date:" paySlip.pdf
paySlip.pdf:Payment Date: 8/7/2016
I have attached my final working code in a reply.