I need to extract text strings from a file and put them in a new file. Each string is always between the same text (tags).
Here's an example (there are hundreds of blocks like this one where I need the data from to be put into one file):
1731 0 obj <</Page 250/Type/Annot/Subtype/Highlight/Rotate 0/Rect[ 95.4715 347.644 337.068 362.041]/NM(929cd95c-f962-4fa3-b734-2e0e67d7b321)/T(iPad)/CreationDate(D:20160818145053Z00'00')/M(D:20160818145204Z00'00')/C[ 0.454902 0.501961 0.988235]/CA 1/QuadPoints[ 95.4715 362.041 337.068 362.041 95.4715 347.644 337.068 347.644]/Contents(EXAMPLE OF TEXT TO BE EXTRACTED)/F 4/Subj(Highlight)>> endobj
I need to extract Page 250 and EXAMPLE OF TEXT TO BE EXTRACTED
For the Page 250 example, the relevant tags seem to be:
For the EXAMPLE OF TEXT TO BE EXTRACTED example, the relevant tags seem to be:
Eventually I would like the pages and the corresponding text to be sorted in ascending order, but I could manage that in a spreadsheet.
I tried to use some answers from here, but I did not manage to make it work...
I am most confortable with Unix command line, but I know a little bit of Python and AppleScript