Skip to content

Use LF for line endings #21

@pabloab

Description

@pabloab
$ 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions