What this template solves
Use this template when the same query parameter appears across many URLs in docs, config, logs, or test fixtures and needs to be updated consistently.
Sample input
https://api.example.com/users?debug=true
/debug?debug=true&mode=fastPrompt to start from
Replace debug=true with debug=false in the file
Expected command
sed 's/debug=true/debug=false/g'Tags
Best for
- Update repeated query parameters in API examples.
- Rewrite tracking or debug flags in copied URLs.
- Replace stale query parameter values in docs or fixtures.
How to use this template
- 1Identify the exact query parameter string to replace.
- 2Copy the sed replacement command for the repeated query value.
- 3Preview the rewritten URLs on sample input before applying the file-edit command.
Template FAQ
How do I replace a repeated query parameter value with sed?
A common pattern is `sed 's/debug=true/debug=false/g'`, which works well when the same query parameter value appears repeatedly across URLs in docs, config, logs, or fixtures.
When is a replace-query-param template most useful?
It is most useful when you need to update one repeated query flag or tracking value across many URLs without manually editing each example line by line.
Related templates
Explore nearby sed workflows that target similar replace, cleanup, filtering, or rewrite tasks.
Replace URL paths
ReplaceReplace an old URL path segment with a new one across many lines.
sed 's#/v1/api#/v2/api#g'Replace domain names
ReplaceReplace an old domain with a new one in bulk.
sed 's/old\.example\.com/new.example.com/g'Replace ports in bulk
ReplaceReplace every 8080 in a config with 80.
sed 's/8080/80/g'