-
-
Notifications
You must be signed in to change notification settings - Fork 724
Open
Description
Describe the bug
yq removes the 3 dashes on Linux when file has CRLF line terminators.
This happens for example with files created on Windoze but modified on Linux.
Version of yq: 4.49.1
Operating system: linux
Installed via: binary release
Reproduce the bug
this works as expected:
echo -e "---\ntest_var: aaa" | file -
/dev/stdin: ASCII textecho -e "---\ntest_var: aaa" | yq '.test_var = "bbb"'
---
test_var: bbbthis removes the 3 dashes:
echo -e "---\ntest_var: aaa" | sed 's/$/\r/' | file -
/dev/stdin: ASCII text, with CRLF line terminatorsecho -e "---\ntest_var: aaa" | sed 's/$/\r/' | yq '.test_var = "bbb"'
test_var: bbbal these ^M are the problem:
echo -e "---\ntest_var: aaa" | sed 's/$/\r/' | cat -A
---^M$
test_var: aaa^M$Solution
The solution for me was to fix all those files with sed 's/\r//', as they in general create problems in bash.
Im opening an issue anyway, maybe other have the same problem without knowing.
Maybe this if fixable, or at least yq could print an error/msg about that.
Great CLI utility btw :) cheers