Skip to content

Instantly share code, notes, and snippets.

@hperantunes
Last active December 28, 2016 19:19
Show Gist options
  • Save hperantunes/c2f2120e88464f085b949a6e73ea3891 to your computer and use it in GitHub Desktop.
Save hperantunes/c2f2120e88464f085b949a6e73ea3891 to your computer and use it in GitHub Desktop.
Sanitizes some JSON response by replacing values
echo '{"somePassword": "password", "someSecret": "secret", "somethingElse": unchanged"}' \
| sed '/\(Password": *"\|Secret": *"\)[^"]*\("\)/ s//\1*****\2/g'
# {"somePassword": "*****", "someSecret": "*****", "somethingElse": unchanged"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment