In yq 4.11.2, If I do this:
echo '---\nfoo: foo\n---\nfoo: foo\n' | yq eval '.foo' -
I get this:
foo
---
foo
Using yq only (not grep, awk, etc.), how can I remove the --- to get this?
foo
foo
In yq 4.11.2, If I do this:
echo '---\nfoo: foo\n---\nfoo: foo\n' | yq eval '.foo' -
I get this:
foo
---
foo
Using yq only (not grep, awk, etc.), how can I remove the --- to get this?
foo
foo
There is a problem with your echo invocation, that it does not expand literal newline characters by default, unless you run with echo -e or enable xpg_echo shell option if you are running this on bash/zsh
mikefarah/yq implementation has a mode -N that prints the filter output with out the document separators See yq --help when tested on version 4.13.3
echo -e '---\nfoo: foo\n---\nfoo: foo\n' | yq -N e '.foo' -
foo
foo