variable=data
How do I extract data
? I need to set variable=
somehow. Running xidel file.txt -e "variable="
gives error err:XPST0003: Unexpected query end
and removing =
gives no results.
Actually xidel is meant to extract data from structured data like xml/html/json with languages like xquery/xpath/templates/jsonic... and is not particularly designed for text based extraction. However, you can toy with $raw and regular expression functions like extract() and replace() to try and get the variable.
So for example, if you have a file.txt with contents like:
var1=one
var2=two
var3=three
you can do the following:
xidel -s file.txt -e "output:=extract($raw,'var2=(.*)',1)"
And the result is:
output := two
Now, assuming you're on windows, you can export this to an environment variable with a for loop and --output-format cmd, like the following link: https://stackoverflow.com/a/38599599/3910330