So for a file containing just {"name": "Google"} then yes
sample='{"name":"Google"}' echo $sample| jq '.name' "Google"
using --raw-output helps
echo $sample| jq --raw-output '.name' Google
But I stumbled upon this question because I was using --raw-output on a json array like this
sample='[{"name":"Yahoo"},{"name":"Google"}]' echo $sample | jq --raw-output 'map(.name)' [ "Yahoo", "Google" ]
And I didn't understand why the quotes remained. I came across this post, and now I know adding | .[] does the trick!
echo $sample | jq --raw-output 'map(.name)| .[]' Yahoo Google
cat foo | baris significantly less efficient thanbar <fooor its equivalent<foo bar, especially ifbaris a program likesortthat can parallelize its operations when given a seekable file descriptor as opposed to a FIFO (which can only be read once front-to-back). It both means more startup overhead (invoking/bin/cat), and more context switches between userspace and kernel (each piece of content going through aread()withincat, then awrite()to a FIFO incat, and then aread()inside your destination program, instead of skipping to that last step directly).cat foo | wc -c, vswc -c <foo-- in the latter case it can just do two syscalls,seek()andtell(), to get the exact size of the file now matter how long it is; in the former, it needs to read to the end, even if that's gigabytes of content, because onlycathas direct access to the original file, andwchas no way to request metadata on it.