How can I get bash/zsh to change some text from "foo.foo.foo" to "foo foo foo" with a script/alias?
You can use tr command to convert character.
% echo "foo.foo.foo" | tr '.' ' '
foo foo foo
Using pure bash:
bash-3.2$ a='a.a.a'
bash-3.2$ echo "${a/./ }"
a a.a
bash-3.2$ echo "${a//./ }"
a a a
You can make a function and add to the end of your ~/.bashrc
, for example:
nodot() { echo "$1" | sed 's/\./ /g' ; }
usage example:
$ nodot foo.foo.foo
foo foo foo
You can use this function in zsh too, just add to your ~/.zshrc
instead.