Question to Filter= and output into "textfiles"

Started by herb, June 25, 2020, 06:43:53 AM

Previous topic - Next topic

herb

Hello Phil,

I work with Exiftool version 12.00 on windows and I have a question to -api Filter=

My application tries to support multiline strings. In order to come to know whether a string contains LFCR I use option
-api Filter=ReplaceNL($_) which changes LF and CR to printable "\n" and "\r".
This works very well but for output into textfiles I have questions.

For output into
- json files: LFCR will always become printable "\r\n". -api Filter= is not necessary.
- xml files: LFCR remains LFCR
- other textfiles: *.txt, *.html and *.args
  LF and CR will always become a dot independant of using -api Filter=

For json and xml files the behaviour is ok, because of the file-format standard.

To create/write the other mentioned outputfile I use options:
-args -w!  %d%f.args
-w!,  %d%f.txt
-h  -w!  %d%f.html

My question: is it possible to also get printable "\r" and "\n" generating an argument file.
Together with #[CSTR] feature it would be possible to write back the original string.

Thanks for your help in advance
Best regards
herb   

Phil Harvey

I don't know what ReplaceNL does, but this should work (quoting/escaping for csh):

exiftool -api 'filter=s/\\/\\\\/g;s/\n/\\n/g;s/\r/\\r/g' -args FILE

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

herb

Hello Phil,

thanks for your reply.

I have to say sorry, that I opened this thread and made so much noice.
The "problem" is caused by my application itself. It used option -n although it should not - and I have overseen this.

Everything is working as expected and documented.

Sorry again and best regards
herb

StarGeek

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).