Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yq sometimes drops the first line if it's a comment #1181

Closed
ttung opened this issue Apr 13, 2022 · 3 comments
Closed

yq sometimes drops the first line if it's a comment #1181

ttung opened this issue Apr 13, 2022 · 3 comments
Labels

Comments

@ttung
Copy link

ttung commented Apr 13, 2022

Describe the bug
I expect echo '# abc\n- def\n# ghi' | yq 'sort' to produce:

# abc
- def
# ghi

However, it drops the # abc and yields

- def
# ghi

Oddly enough, yq . doesn't drop the comment:

% echo '# abc\n- def\n# ghi' | yq .     
# abc
- def
# ghi

Version of yq: 4.21.1
Operating system: mac
Installed via: macports

Input Yaml

# abc
- def
# ghi

Command
echo '# abc\n- def\n# ghi' | yq 'sort'
echo '# abc\n- def\n# ghi' | yq .

Actual behavior

# abc
- def
# ghi

Expected behavior

- def
# ghi

Additional context
N/A

@mikefarah
Copy link
Owner

Thanks for reporting, will fix in the next release.

@mikefarah
Copy link
Owner

Fixed in 4.24.5

@daydy16
Copy link

daydy16 commented Sep 19, 2022

same error when using | line
doesnt count the first line, when it's a comment.
Is this a bug or intentional?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants