While working on one of our Java projects on macOS it was required to do a search and replace in all Java files containing a string sequence. In our case it was required to change every JavaDoc "
@since 2.3.0" into "
@since 2.1.5, 2.3.0".
sed is the tool for this, and since BSD's implementation differs from GNU sed, we opted to stick to GNU sed which is available on Homebrew:
brew install gnu-sed
Then the magic combining
find src/ -name '*.java' | xargs gsed -i -e "s/@since 2.3.0/@since 2.1.5, 2.3.0/g"