Remove Quotes From Strings
Here’s the command to remove quotes from a string in Bash by using the tr -d command. I’m using jq tool to extract the access key from a json file. Bash returns a string surrounded by quotes. To remove the quotes, just pipe the string to the tr -d command.
<pre lang="bash">
jq .AccessKey.AccessKeyId key.json
Result:
<pre lang="bash">
"ASDFSDFSDFASDFSDFSDFGHGDF"
Using tr -d.
<pre lang="bash">
jq .AccessKey.AccessKeyId key.json | tr -d \"
Result:
<pre lang="bash">
ASDFSDFSDFASDFSDFSDFGHGDF