marcli icon indicating copy to clipboard operation
marcli copied to clipboard

Use LF for line endings

Open pabloab opened this issue 7 months ago • 1 comments

$ marcli_linux -fields 650 -match 'and' -matchFields 245 -file test_1a.mrc
=650  \0$aCoal$xAnalysis.
=650  \0$aCoal$xSampling.

I want only lines ending with Analysis.:

$ marcli_linux -fields 650 -match 'and' -matchFields 245 -file test_1a.mrc | rg 'Analysis\.$' # same with grep
$

Odd... let's show all characters:

$ marcli_linux -fields 650 -match 'and' -matchFields 245 -file test_1a.mrc | cat -A
=650  \0$aCoal$xAnalysis.^M$
=650  \0$aCoal$xSampling.^M$
^M$

$ marcli_linux -fields 650 -match 'and' -matchFields 245 -file test_1a.mrc | sed 's/\r$//' | rg 'sis\.$' # same with dos2unix
=650  \0$aCoal$xAnalysis.

$ marcli_linux -fields 650 -match 'and' -matchFields 245 -file test_1a.mrc > foo
$ file foo
foo: ASCII text, with CRLF line terminators

Any modern text editors, Linux, macOS, and even Notepad (since Windows 10 Insider build) work with LF line endings. Would be great to output with those, or at least follow the current platform.

Basically, would be to replace \r\n\n.

pabloab avatar Jun 07 '25 05:06 pabloab