I've used jq on Mac/Unix successfully for several years and have now been asked to port a project from Mac to Windows.
My problem is that I am unable to run any command in jq under Windows with the .json files that work perfectly on the Mac.
This includes the simplest command:
jq -r . /path/to/json.json
All commands cause a crash of jq. I'm running Windows 10 Pro.
What I've tried:
-Installing jq using chocolatey as well as downloading the precompiled 32-bit and 64-bit binaries directly.
-Using a standard command prompt, an elevated command prompt and PowerShell.
The .json files all have UTF-8 encoding without BOM and I've tried them with both Windows and Unix line endings. jq crashes regardless.
Can anyone please provide any guidance as to why a simple port to Windows would be so problematic, or maybe some simple issue I am overlooking?
Thanks
This includes the simplest command:
jq -r . /path/to/json.json
To ascertain the nature of the problem, it would probably be better to start with an even simpler command, such as:
jq -n .
If that fails, maybe there is a 32-bit/64-bit mismatch.
Also, when specifying pathnames, you will have to use Windows conventions.
Please note that jq 1.5 cannot handle long Windows pathnames. You can obtain a more recent version of jq pre-compiled for Windows from Appveyor, as explained at
https://github.com/stedolan/jq/wiki/Installation#windows-using-appveyor
Related
I can only use the command line for this task, how would you convert echo -n "mystringtoencode" | sha1sum so it works on windows?
Or more broadly, what is the command to encode a string with sha-1 on windows?
Thanks!
According to a Microsoft Support page:
FCIV -md5 -sha1 path\filename.ext
It doesn't look like it's available normally (my up-to-date Win10 doesn't have it). You'll have to download it.
If your scenario lets you use PowerShell, there's the Get-FileHash command which has MD5 and a number of versions of SHA. This might be your best no-download option.
If you really want Windows to have all the small tools that Linux has, you can get a big list of them by downloading GOW (GNU On Windows) and adding it's binaries to your path. This includes sha1sum. These are Windows binaries running in the Windows kernel.
There's always the Windows Subsystem for Linux (WSL) which also has a lot of Linux tools running in a more Linux-like environment but I think that might be a bit over kill for hashing files. These will be Linux binaries running on a version of the Linux kernel. It's actually not bad.
I am trying to use xxd command to convert string to hex.
I have typed this command in cmd in windows xxd -p <<< "Hello world".
But I have got this in my cmd
'xxd' is not recognized as an internal or external command, operable program or batch file.
How can I use xxd in cmd in windows?
Thanks.
Use VIM for this
https://ftp.nluug.nl/pub/vim/pc/gvim73_46_s.zip
C:\Program Files (x86)\Vim\vim74>.\xxd -v
Source: https://superuser.com/a/638850
You could use git-bash to do that if you have installed it.
Short answer is you probably can't because it's a UNIX command...
What you can do is use GnuWin32/MinGW/CygWin, which are ports of Linux GNU utilities fro Windows.
Read more about them here:
Difference between GNUWin32 and cygwin
These days the full linux kernel is made available and officially supported by windows via WSL. Once installed, a program like Windows Terminal can be used to execute linux commands.
See this utility clone.
https://sourceforge.net/projects/xxd-for-windows/
The operation is similar. To see in hexadecimnal use "xxd file.txt", to see in binary use "xxd -b file.txt".
I am running Windows 10 on this laptop and recently was recommend to install grep. Well I did that by installing it with a program called GNUWin32.
For some reason I can't get grep to work. Maybe I'm stupid? I don't know but when I type the grep command in CMD it doesn't recognize it.
Any ideas?
I am trying to run the perl script through command line but it is not reorganizing the script file ie.
myscript.pl... is not working
but perl myscript.pl is working fine
I have tried the following suggestions but they didn't work either
How do I make my Perl scripts act like normal programs on Windows?
Perl execution from command line question
I am using Active Perl:- Perl 5 , Version 18.
It gives following warnings in both cases.
Using a hash as a reference is deprecated
earlier I installed strawberry perl before installing active perl, is that causing some problem.
The error message
Using a hash as a reference is deprecated
is a Perl message. Your script is being run just fine, but contains an error.
(It is remotely possible that you have two Perl versions installed, and that you configured Windows to use the wrong one. Reconfigure it to use the correct on then, using the guides you already found.)
I've been trying to get a co-worker's linux build scripts for set of large grails apps to work in windows (via cygwin). He uses a lot of 'here documents' but I can reduce my problem down to a simple question - how, in windows or cygwin, do I get grails to accept a series of commands from stdin -- i.e. 'grails < cmds'. Every time I try this grails simply opens with the 'grails>' interactive prompt.
I have tried all variations of -Djline=jline.(Windows Linux Unsupported)Terminal with -non-interactive and cygwin and cmd (Windows 7 64 bit, grails 2.3.5 by the way) but in all it seems to ignore the redirection of stdin. I've even tried the variation 'cat cmds | grails ..... '
I've looked through the jiras but haven't found anything definitive. There were some comments about moving to different windows consoles (e.g. conemu) but that didn't solve anything for me.
Moving off windows is not an option :(
Anyone seen/solved this problem before or have any insights ?
What is grails? I mean, what exactly is started when you run it?
Look in Task Manager or Process Explorer for command line. Supposing, it runs java.exe, so you need to replicate full command line and just use trailing redirector of yours < cmds.