ExifTool Forum

ExifTool => Developers => Topic started by: herb on June 25, 2020, 06:43:53 AM

Title: Question to Filter= and output into "textfiles"
Post by: herb on June 25, 2020, 06:43:53 AM
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   
Title: Re: Question to Filter= and output into "textfiles"
Post by: Phil Harvey on June 25, 2020, 08:50:41 AM
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
Title: Re: Question to Filter= and output into "textfiles"
Post by: herb on June 25, 2020, 08:58:14 AM
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
Title: Re: Question to Filter= and output into "textfiles"
Post by: StarGeek on June 25, 2020, 12:21:39 PM
Quote from: Phil Harvey on June 25, 2020, 08:50:41 AM
I don't know what ReplaceNL does,

ReplaceNL was a helper function created here (https://exiftool.org/forum/index.php?topic=9348.msg48567#msg48567).