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

Add String interpolation #1149

ivangreene opened this issue Mar 21, 2022 · 2 comments

Add String interpolation #1149

ivangreene opened this issue Mar 21, 2022 · 2 comments


Copy link

Describe the bug
String interpolation (with \(expression) syntax) doesn't work. The expression and surrounding \() is printed literally in the resulting string.

Version of yq: 4.22.1
Operating system: mac
Installed via: homebrew

Input Yaml
Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less)

value: 3

The command you ran:

yq '"value: \(.value)"' data1.yml

Actual behavior

value: \(.value)

Expected behavior

value: 3

Additional context
Example of the expected behavior with jq:

$ jq '"value: \(.value)"' <<< '{"value": 3}'
"value: 3"
@mikefarah mikefarah added enhancement and removed bug labels Mar 21, 2022
@mikefarah mikefarah changed the title String interpolation doesn't work Add String interpolation Mar 21, 2022
Copy link

I haven't actually added that feature in yet (and didn't know that you could do that in jq!) Until then, you can get similar result by either using string concatenation, or using envsubst

mikefarah added a commit that referenced this issue Mar 5, 2024
Copy link

Fixed in v4.43.1 :)

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

No branches or pull requests

2 participants