On 10/5/2016 1:17 PM, KRIS MUSSHORN wrote: > Will someone please tell me why this stores the text "numDocs" instead > of returning the number of docs in the core? #!/bin/bash > DOC_COUNT=`wget -O- -q > $SOLR_HOST'admin/cores?action=STATUS&core='$SOLR_CORE_NAME'&wt=json&indent=true' > | grep numDocs | tr -d '0-9'`
The "-d" option on the "tr" command means "delete" ... so the final command in that pipe says "delete all numbers." I think that is probably the exact opposite of what you're trying to do. If your "tr" command supports the "-c" option to operate on the complement of the set, you can you add that option before "-d". Then the command should delete everything *except* the numbers, and I think it will do what you're after. It seemed to work for me, at least. Another suggestion you've gotten is to use jq to parse the json directly. That would be very effective, and would continue to work even if Solr's indented JSON output format were to change. It does assume the presence of a tool that's less common, though. Thanks, Shawn