I renamed your script, but here's an option:
$ ./myscript.sh xxx.xxx.xxx.xxx:8080/code -c code1 -t query
after executing the script, use:
$ ^code1^code2
... which results in:
./myscript.sh xxx.xxx.xxx.xxx:8080/code -c code2 -t query
man bash
and search for "Event Designators":
^string1^string2^
Quick substitution. Repeat the last command, replacing string1 with string2. Equivalent to !!:s/string1/string2/
Editing to add global replacement, which I learned just now from @slm's answer at https://unix.stackexchange.com/a/116626/117549:
$ !!:gs/string1/string2
which says:
!! - recall the last command
g - perform the substitution over the whole line
s/string1/string2 - replace string1 with string2
b
? – lese Nov 16 '15 at 13:44echo http://xxx.xxx.xxx.xxx/a/b/b/c/d/e | sed 's/b/c/g'
? Please tell what do you want to do, execute a command,call a program that will reach that url, change a variable value...?!? – Hastur Nov 16 '15 at 14:15fc-s
. – Hans Ginzel Sep 03 '20 at 13:46