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

Can't write a string value with a white space #607

Closed
clementnero opened this issue Dec 21, 2020 · 9 comments · Fixed by #611
Closed

Can't write a string value with a white space #607

clementnero opened this issue Dec 21, 2020 · 9 comments · Fixed by #611
Labels
Milestone

Comments

@clementnero
Copy link

Describe the bug
I can't write a string value containing a white space.

Version of yq: 4.0.0
Operating system: mac
Installed via: release/homebrew

Command

yq e -n '.test = "Hello world!"'

Actual behavior

Error: Parsing expression: Lexer error: could not match text starting at 1:9 failing at 1:16.
        unmatched text: "\"Hello "

Expected behavior

test: Hello world!

Additional context
It works if there is no white space:

yq e -n '.test = "Hello-world!"'

Thanks for your help

@djajcevic
Copy link
Contributor

I'm going to figure out why... Will be posting MR soon...

@dhegland
Copy link

I mam trying to use yq and having zero success,
including the exact symptom documented in this issue right here above.
..........................................

PS /> yq -V
yq version 4.3.2

PS /> yq e -n '.test = "Hello_world!"'
Error: Parsing expression: Lexer error: could not match text starting at 1:9 failing at 1:10.
unmatched text: "H"

@mikefarah
Copy link
Owner

is that powershell? There's an issue raised here #719 that I still need to look into...try using double quotes?

@dhegland
Copy link

Thanks @mikefarah the above was indeed PowerShell.
Touche! It does work in bash. :) That is very clarifying. Thanks a bunch for the pointer.
:) You win this round :)

$ yq e -n '.test = "Hello_world!"'
test: Hello_world!

@dhegland
Copy link

@mikefarah

Here's powershell working right
PS > yq e -n '.test = ""something""'
test: something
PS >

Thanks again for your help

@sdthameem
Copy link

sdthameem commented Jun 3, 2021

Hi ,

I am facing similar issues when using yq command in power shell.
Below is the command
PS > yq eval 'to_entries' sample.yaml
Error: Parsing expression: Lexer error: could not match text starting at 1:1 failing at 1:3.
unmatched text: "to"

PS > cat sample.yaml
BU: local-market

@ThibaultDelaune-pro
Copy link

@sdthameem, @mikefarah,

I am facing similar issues when using yq command in power shell.
Below is the command
PS > yq eval 'to_entries' sample.yaml
Error: Parsing expression: Lexer error: could not match text starting at 1:1 failing at 1:3.
unmatched text: "to"

Hi, same here on Windows (Git Bash) in version 4.6.3 :

$ yq eval 'to_entries' pipeline.yaml
Error: Parsing expression: Lexer error: could not match text starting at 1:1 failing at 1:3.
        unmatched text: "to"
$ yq eval 'from_entries' pipeline.yaml
Error: Parsing expression: Lexer error: could not match text starting at 1:1 failing at 1:3.
        unmatched text: "fr"

@SourceTrees
Copy link

SourceTrees commented Sep 28, 2021

yq Version 4.11.0

@ThibaultDelaune-pro
Working in Windows GitBash:
yq e -i '.test = "13137"' values.yaml

Subpath for example folder1/values.yaml not found though had to run it from values.yaml root.

Working in Powershell Windows:
yq e -i '.test = ""13137""' values.yaml

Subpaths are found, so you could call it form folder1/values.yaml
@sdthameem Pay attention on the double quote in Windows Powershell ""13137""

@mxchist
Copy link

mxchist commented Jul 14, 2022

Now i'm trying to use yq and having zero success.
I want bypass output of kubectl command to yq.

How is look yaml input for yq

kubectl get deployments -o custom-columns=IMAGE:. -o yaml
makes output:

apiVersion: v1
items:
- apiVersion: extensions/v1beta1
  kind: Deployment
  <...>

yq query

kubectl get deployments -o custom-columns=IMAGE:. -o yaml | yq 'items' -

Actual behavior

Error: parsing expression: Lexer error: could not match text starting at 1:1 failing at 1:3.
	unmatched text: "it"

Expected behavior

Return spec node

yq 4.25.3 from the snap, Linux Ubuntu 20.04.1

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

Successfully merging a pull request may close this issue.

8 participants