How to remove double-quotes in jq output for parsing json files in bash?

I’m using jq to parse a JSON file as shown here. However, the results for string values contain the “double-quotes” as expected, as shown below: $ cat json.txt | jq ‘.name’ “Google” How can I pipe this into another command to remove the “”? so I get $ cat json.txt | jq ‘.name’ | some_other_command … Read more

Non greedy (reluctant) regex matching in sed?

I’m trying to use sed to clean up lines of URLs to extract just the domain. So from: http://www.suepearson.co.uk/product/174/71/3816/ I want: http://www.suepearson.co.uk/ (either with or without the trailing slash, it doesn’t matter) I have tried: sed ‘s|\(http:\/\/.*?\/\).*|\1|’ and (escaping the non-greedy quantifier) sed ‘s|\(http:\/\/.*\?\/\).*|\1|’ but I can not seem to get the non-greedy quantifier (?) … Read more

Find and replace in file and overwrite file doesn’t work, it empties the file

I would like to run a find and replace on an HTML file through the command line. My command looks something like this: sed -e s/STRING_TO_REPLACE/STRING_TO_REPLACE_IT/g index.html > index.html When I run this and look at the file afterward, it is empty. It deleted the contents of my file. When I run this after restoring … Read more