I have a file ~/foo.txt that has instances of each of the following strings
alpha-1
alpha-2
alpha-3
alpha-4
alpha-5
alpha-6
alpha-7
alpha-8
alpha-9
I would like to replace each of these alpha-X with beta-X. Simply replacing alpha- with beta- will not suffice as there are other instances of alpha- that I want to preserve.
I imagine this can be accomplished with something like
perl -p -i -e `s/alpha-SOMETHING/beta-SOMETHING/g'
but I'm not sure what SOMETHING should be. Is there a solution here?
(Of course, I could run nine one-liners but this seems very inefficient.)
SOMETHINGlikes/alpha(-[[:digit:]])\b/beta$1/g\dfor[[:digit:]]